diff --git a/.idea/misc.xml b/.idea/misc.xml index 3dd2a0c..75af768 100755 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,7 +6,7 @@ - + diff --git a/src/com/bulenkov/darcula/DarculaLaf.java b/src/com/bulenkov/darcula/DarculaLaf.java index cd8cfdd..9380dd3 100755 --- a/src/com/bulenkov/darcula/DarculaLaf.java +++ b/src/com/bulenkov/darcula/DarculaLaf.java @@ -16,6 +16,7 @@ package com.bulenkov.darcula; +import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.util.ColorUtil; import com.bulenkov.iconloader.util.StringUtil; import com.bulenkov.iconloader.util.SystemInfo; @@ -92,6 +93,9 @@ public final class DarculaLaf extends BasicLookAndFeel { patchComboBox(metalDefaults, defaults); defaults.remove("Spinner.arrowButtonBorder"); defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5)); + defaults.put("Tree.collapsedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeCollapsed.png"))); + defaults.put("Tree.expandedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeExpanded.png"))); + return defaults; } catch (Exception ignore) { diff --git a/src/com/bulenkov/darcula/DarculaUIUtil.java b/src/com/bulenkov/darcula/DarculaUIUtil.java index 10eb795..64d809c 100755 --- a/src/com/bulenkov/darcula/DarculaUIUtil.java +++ b/src/com/bulenkov/darcula/DarculaUIUtil.java @@ -15,11 +15,9 @@ */ package com.bulenkov.darcula; -import com.bulenkov.iconloader.util.ColorUtil; -import com.bulenkov.iconloader.util.DoubleColor; -import com.bulenkov.iconloader.util.SystemInfo; -import com.bulenkov.iconloader.util.UIUtil; +import com.bulenkov.iconloader.util.*; +import javax.swing.*; import java.awt.*; /** @@ -140,5 +138,35 @@ public class DarculaUIUtil { g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue); } + public static Icon getTreeNodeIcon(boolean expanded, boolean selected, boolean focused) { + boolean white = (selected && focused) || UIUtil.isUnderDarcula(); + + Icon selectedIcon = getTreeSelectedExpandedIcon(); + Icon notSelectedIcon = getTreeExpandedIcon(); + + int width = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth()); + int height = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth()); + + return new CenteredIcon(expanded ? (white ? getTreeSelectedExpandedIcon() : getTreeExpandedIcon()) + : (white ? getTreeSelectedCollapsedIcon() : getTreeCollapsedIcon()), + width, height, false + ); + } + + public static Icon getTreeCollapsedIcon() { + return UIManager.getIcon("Tree.collapsedIcon"); + } + + public static Icon getTreeExpandedIcon() { + return UIManager.getIcon("Tree.expandedIcon"); + } + + public static Icon getTreeSelectedCollapsedIcon() { + return getTreeCollapsedIcon(); + } + + public static Icon getTreeSelectedExpandedIcon() { + return getTreeExpandedIcon(); + } } diff --git a/src/com/bulenkov/darcula/darcula.properties b/src/com/bulenkov/darcula/darcula.properties index c1cab5c..9d029a7 100755 --- a/src/com/bulenkov/darcula/darcula.properties +++ b/src/com/bulenkov/darcula/darcula.properties @@ -159,7 +159,5 @@ Hyperlink.linkColor=589df6 #Table.background=45494A #Tree.background=45494A -Tree.collapsedIcon=AllIcons.Mac.Tree_white_right_arrow -Tree.expandedIcon=AllIcons.Mac.Tree_white_down_arrow FileView.fileIcon=AllIcons.FileTypes.Unknown \ No newline at end of file diff --git a/src/com/bulenkov/darcula/icons/treeNodeCollapsed.png b/src/com/bulenkov/darcula/icons/treeNodeCollapsed.png new file mode 100644 index 0000000..1bff901 Binary files /dev/null and b/src/com/bulenkov/darcula/icons/treeNodeCollapsed.png differ diff --git a/src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png b/src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png new file mode 100644 index 0000000..1b034a9 Binary files /dev/null and b/src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png differ diff --git a/src/com/bulenkov/darcula/icons/treeNodeExpanded.png b/src/com/bulenkov/darcula/icons/treeNodeExpanded.png new file mode 100644 index 0000000..f10b84d Binary files /dev/null and b/src/com/bulenkov/darcula/icons/treeNodeExpanded.png differ diff --git a/src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png b/src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png new file mode 100644 index 0000000..fa2ad0b Binary files /dev/null and b/src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png differ diff --git a/src/com/bulenkov/darcula/ui/DarculaTreeUI.java b/src/com/bulenkov/darcula/ui/DarculaTreeUI.java index 7731878..b17cac0 100644 --- a/src/com/bulenkov/darcula/ui/DarculaTreeUI.java +++ b/src/com/bulenkov/darcula/ui/DarculaTreeUI.java @@ -16,6 +16,7 @@ package com.bulenkov.darcula.ui; +import com.bulenkov.darcula.DarculaUIUtil; import com.bulenkov.iconloader.util.SystemInfo; import com.bulenkov.iconloader.util.UIUtil; @@ -413,8 +414,8 @@ public class DarculaTreeUI extends BasicTreeUI { boolean isLeaf) { boolean isPathSelected = tree.getSelectionModel().isPathSelected(path); if (!isLeaf(row)) { - setExpandedIcon(UIUtil.getTreeNodeIcon(true, isPathSelected, tree.hasFocus())); - setCollapsedIcon(UIUtil.getTreeNodeIcon(false, isPathSelected, tree.hasFocus())); + setExpandedIcon(DarculaUIUtil.getTreeNodeIcon(true, isPathSelected, tree.hasFocus())); + setCollapsedIcon(DarculaUIUtil.getTreeNodeIcon(false, isPathSelected, tree.hasFocus())); } super.paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); diff --git a/swingset3/com/sun/swingset3/demos/DemoUtilities.java b/swingset3/com/sun/swingset3/demos/DemoUtilities.java index 92bbffe..552ebb1 100644 --- a/swingset3/com/sun/swingset3/demos/DemoUtilities.java +++ b/swingset3/com/sun/swingset3/demos/DemoUtilities.java @@ -30,11 +30,10 @@ */ package com.sun.swingset3.demos; +import javax.swing.*; import java.awt.*; -import java.net.URI; import java.io.IOException; -import javax.swing.*; -import javax.jnlp.*; +import java.net.URI; /** * @author Pavel Porvatov @@ -107,7 +106,7 @@ public class DemoUtilities { toplevel.setLocation(x, y); } - public static boolean browse(URI uri) throws IOException, UnavailableServiceException { + public static boolean browse(URI uri) throws IOException { // Try using the Desktop api first try { Desktop desktop = Desktop.getDesktop(); @@ -115,13 +114,6 @@ public class DemoUtilities { return true; } catch (SecurityException e) { - // Running in sandbox, try using WebStart service - BasicService basicService = - (BasicService) ServiceManager.lookup("javax.jnlp.BasicService"); - - if (basicService.isWebBrowserSupported()) { - return basicService.showDocument(uri.toURL()); - } } return false; diff --git a/swingset3/com/sun/swingset3/demos/table/TableDemo.java b/swingset3/com/sun/swingset3/demos/table/TableDemo.java index ed304d6..6acea52 100644 --- a/swingset3/com/sun/swingset3/demos/table/TableDemo.java +++ b/swingset3/com/sun/swingset3/demos/table/TableDemo.java @@ -399,8 +399,8 @@ public class TableDemo extends JPanel { new ArrayList>(2); filters.add(winnerFilter); filters.add(searchFilter); - RowFilter comboFilter = RowFilter.andFilter((Iterable>) filters); - sorter.setRowFilter(comboFilter); +// RowFilter comboFilter = RowFilter.andFilter((Iterable>) filters); + sorter.setRowFilter(RowFilter.andFilter(filters)); } else if (showOnlyWinners) { sorter.setRowFilter(winnerFilter); } else if (hasFilterString()) { diff --git a/swingset3/com/sun/swingset3/utilities/Utilities.java b/swingset3/com/sun/swingset3/utilities/Utilities.java index 2b19ad6..e8b3751 100644 --- a/swingset3/com/sun/swingset3/utilities/Utilities.java +++ b/swingset3/com/sun/swingset3/utilities/Utilities.java @@ -31,16 +31,11 @@ package com.sun.swingset3.utilities; -import java.awt.Color; -import java.awt.GradientPaint; -import java.awt.Graphics2D; -import java.awt.GraphicsEnvironment; -import java.awt.Transparency; +import javax.swing.*; +import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.net.URL; -import javax.jnlp.ServiceManager; -import javax.swing.SwingConstants; /** * @@ -53,7 +48,7 @@ public class Utilities { } public static boolean runningFromWebStart() { - return ServiceManager.getServiceNames() != null; + return false; } public static String getURLFileName(URL url) {