javax.swing.plaf.IconUIResource Java Examples
The following examples show how to use
javax.swing.plaf.IconUIResource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiResolutionImageHack.java From visualvm with GNU General Public License v2.0 | 6 votes |
private static void hackIcon(ImageIcon icon) { try { // Create a dummy image observer JPanel p = new JPanel(); // Set the image observer to the multi-resolution image icon.setImageObserver(p); // Mac OS X specific if (Platform.isMac()) { Method getInvertedIcon = icon.getClass().getMethod("getInvertedIcon"); // NOI18N getInvertedIcon.setAccessible(true); IconUIResource invertedIcon = (IconUIResource)getInvertedIcon.invoke(icon); Field delegate = invertedIcon.getClass().getDeclaredField("delegate"); // NOI18N delegate.setAccessible(true); ImageIcon imageIcon = (ImageIcon)delegate.get(invertedIcon); // Set the image observer to the inverted multi-resolution image imageIcon.setImageObserver(p); } } catch (Throwable t) { Logger logger = Logger.getLogger(MultiResolutionImageHack.class.getName()); logger.log(Level.FINE, "Failed to apply MultiResolutionToolkitImageCacheHack", t); // NOI18N } }
Example #2
Source File: bug6604281.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #3
Source File: DarculaLaf.java From Darcula with Apache License 2.0 | 5 votes |
private static Object parseValue(String key, String value) { if ("null".equals(value)) { return null; } if (key.endsWith("Insets")) { final List<String> numbers = StringUtil.split(value, ","); return new InsetsUIResource(Integer.parseInt(numbers.get(0)), Integer.parseInt(numbers.get(1)), Integer.parseInt(numbers.get(2)), Integer.parseInt(numbers.get(3))); } else if (key.endsWith(".border")) { try { return Class.forName(value).newInstance(); } catch (Exception e) {log(e);} } else { final Color color = ColorUtil.fromHex(value, null); final Integer invVal = getInteger(value); final Boolean boolVal = "true".equals(value) ? Boolean.TRUE : "false".equals(value) ? Boolean.FALSE : null; Icon icon = key.toLowerCase().endsWith("icon") ? null : null; //TODO: copy image loading if (color != null) { return new ColorUIResource(color); } else if (invVal != null) { return invVal; } else if (icon != null) { return new IconUIResource(icon); } else if (boolVal != null) { return boolVal; } } return value; }
Example #4
Source File: DarculaLaf.java From Darcula with Apache License 2.0 | 5 votes |
@Override public UIDefaults getDefaults() { try { final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults"); superMethod.setAccessible(true); final UIDefaults metalDefaults = (UIDefaults)superMethod.invoke(new MetalLookAndFeel()); final UIDefaults defaults = (UIDefaults)superMethod.invoke(base); initInputMapDefaults(defaults); initIdeaDefaults(defaults); patchStyledEditorKit(); 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"))); defaults.put("Menu.arrowIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/menuItemArrowIcon.png"))); defaults.put("CheckBoxMenuItem.checkIcon", EmptyIcon.create(16)); defaults.put("RadioButtonMenuItem.checkIcon", EmptyIcon.create(16)); defaults.put("InternalFrame.icon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/internalFrame.png"))); defaults.put("OptionPane.informationIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_info.png"))); defaults.put("OptionPane.questionIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_question.png"))); defaults.put("OptionPane.warningIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_warning.png"))); defaults.put("OptionPane.errorIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_error.png"))); if (SystemInfo.isMac && !"true".equalsIgnoreCase(System.getProperty("apple.laf.useScreenMenuBar", "false"))) { defaults.put("MenuBarUI", "com.bulenkov.darcula.ui.DarculaMenuBarUI"); defaults.put("MenuUI", "javax.swing.plaf.basic.BasicMenuUI"); } return defaults; } catch (Exception ignore) { log(ignore); } return super.getDefaults(); }
Example #5
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
private MainPanel() { super(new BorderLayout()); Icon emptyIcon = new EmptyIcon(); UIManager.put("Tree.expandedIcon", new IconUIResource(emptyIcon)); UIManager.put("Tree.collapsedIcon", new IconUIResource(emptyIcon)); JTree tree = new JTree(); for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } JCheckBox check = new JCheckBox("JTree: paint expanded, collapsed Icon"); check.addActionListener(e -> { Icon ei; Icon ci; if (((JCheckBox) e.getSource()).isSelected()) { UIDefaults lnfdef = UIManager.getLookAndFeelDefaults(); ei = lnfdef.getIcon("Tree.expandedIcon"); ci = lnfdef.getIcon("Tree.collapsedIcon"); } else { ei = emptyIcon; ci = emptyIcon; } UIManager.put("Tree.expandedIcon", new IconUIResource(ei)); UIManager.put("Tree.collapsedIcon", new IconUIResource(ci)); SwingUtilities.updateComponentTreeUI(tree); }); JPanel p = new JPanel(new GridLayout(1, 2)); p.add(new JScrollPane(tree)); p.add(new JScrollPane(new JTree())); add(check, BorderLayout.NORTH); add(p); setPreferredSize(new Dimension(320, 240)); }
Example #6
Source File: ModernDarkLaf.java From consulo with Apache License 2.0 | 5 votes |
protected Object parseValue(String key, @Nonnull String value) { if (key.endsWith("Insets")) { final List<String> numbers = StringUtil.split(value, ","); return new InsetsUIResource(Integer.parseInt(numbers.get(0)), Integer.parseInt(numbers.get(1)), Integer.parseInt(numbers.get(2)), Integer.parseInt(numbers.get(3))); } else if (key.endsWith(".border")) { try { return Class.forName(value).newInstance(); } catch (Exception e) { log(e); } } else { final Color color = parseColor(value); final Integer invVal = getInteger(value); final Boolean boolVal = "true".equals(value) ? Boolean.TRUE : "false".equals(value) ? Boolean.FALSE : null; Icon icon = value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null; if (icon == null && value.endsWith(".png")) { icon = IconLoader.findIcon(value, getClass(), true); } if (color != null) { return new ColorUIResource(color); } else if (invVal != null) { return invVal; } else if (icon != null) { return new IconUIResource(icon); } else if (boolVal != null) { return boolVal; } } return value; }
Example #7
Source File: bug6604281.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #8
Source File: bug6604281.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #9
Source File: DarculaLaf.java From consulo with Apache License 2.0 | 5 votes |
protected Object parseValue(String key, @Nonnull String value) { if (key.endsWith("Insets") || key.endsWith("padding")) { final List<String> numbers = StringUtil.split(value, ","); return new InsetsUIResource(Integer.parseInt(numbers.get(0)), Integer.parseInt(numbers.get(1)), Integer.parseInt(numbers.get(2)), Integer.parseInt(numbers.get(3))); } else if (key.endsWith(".border")) { try { return Class.forName(value).newInstance(); } catch (Exception e) {log(e);} } else { final Color color = parseColor(value); final Integer invVal = getInteger(value); final Boolean boolVal = "true".equals(value) ? Boolean.TRUE : "false".equals(value) ? Boolean.FALSE : null; Icon icon = value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null; if (icon == null && (value.endsWith(".png") || value.endsWith(".svg"))) { icon = IconLoader.findIcon(value, getClass(), true); } if (color != null) { return new ColorUIResource(color); } else if (invVal != null) { return invVal; } else if (icon != null) { return new IconUIResource(icon); } else if (boolVal != null) { return boolVal; } } return value; }
Example #10
Source File: bug6604281.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #11
Source File: bug6604281.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #12
Source File: bug6604281.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #13
Source File: bug6604281.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #14
Source File: bug6604281.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #15
Source File: bug6604281.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #16
Source File: bug6604281.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #17
Source File: bug6604281.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #18
Source File: bug6604281.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #19
Source File: bug6604281.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SynthLookAndFeel laf = new SynthLookAndFeel(); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { fail(e.getMessage()); } // Prepare image BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, image.getWidth(), image.getHeight()); graphics.setColor(Color.RED); graphics.drawLine(0, 0, image.getWidth(), image.getHeight()); // Use IconUIResource as an icon, because with ImageIcon bug is not reproduced JButton button1 = new JButton(new IconUIResource(new ImageIcon(image))); JButton button2 = new JButton(new IconUIResource(new ImageIcon(image))); button2.setEnabled(false); if (button1.getPreferredSize().getHeight() != button2.getPreferredSize().getHeight()) { fail("Two similar buttons have different size"); } } }); }
Example #20
Source File: DarculaCheckBoxUI.java From consulo with Apache License 2.0 | 4 votes |
@Override public Icon getDefaultIcon() { return new IconUIResource(JBUI.emptyIcon(20)); }
Example #21
Source File: ModernRadioButtonUI.java From consulo with Apache License 2.0 | 4 votes |
@Override public Icon getDefaultIcon() { return new IconUIResource(JBUI.emptyIcon(20)); }
Example #22
Source File: ModernCheckBoxUI.java From consulo with Apache License 2.0 | 4 votes |
@Override public Icon getDefaultIcon() { return new IconUIResource(JBUI.emptyIcon(20)); }
Example #23
Source File: DarculaRadioButtonUI.java From Darcula with Apache License 2.0 | 4 votes |
@Override public Icon getDefaultIcon() { return new IconUIResource(EmptyIcon.create(20)); }
Example #24
Source File: DarculaCheckBoxUI.java From Darcula with Apache License 2.0 | 4 votes |
@Override public Icon getDefaultIcon() { return new IconUIResource(EmptyIcon.create(20)); }
Example #25
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
private MainPanel() { super(new BorderLayout(2, 2)); JTree tree = new JTree(); tree.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); int lci = UIManager.getInt("Tree.leftChildIndent"); SpinnerNumberModel leftChildIndent = new SpinnerNumberModel(lci, -32, 32, 1); int rci = UIManager.getInt("Tree.rightChildIndent"); SpinnerNumberModel rightChildIndent = new SpinnerNumberModel(rci, -32, 32, 1); Box box1 = Box.createHorizontalBox(); box1.add(new JLabel(" Tree.leftChildIndent:")); box1.add(new JSpinner(leftChildIndent)); box1.add(new JLabel(" Tree.rightChildIndent:")); box1.add(new JSpinner(rightChildIndent)); Box box2 = Box.createHorizontalBox(); box2.add(Box.createHorizontalGlue()); box2.add(paintLines); box2.add(expandedIcon); JButton update = new JButton("update"); box2.add(update); Icon emptyIcon = new EmptyIcon(); update.addActionListener(e -> { UIManager.put("Tree.leftChildIndent", leftChildIndent.getNumber().intValue()); UIManager.put("Tree.rightChildIndent", rightChildIndent.getNumber().intValue()); Icon ei; Icon ci; if (expandedIcon.isSelected()) { UIDefaults lnfDef = UIManager.getLookAndFeelDefaults(); ei = lnfDef.getIcon("Tree.expandedIcon"); ci = lnfDef.getIcon("Tree.collapsedIcon"); } else { ei = emptyIcon; ci = emptyIcon; } UIManager.put("Tree.expandedIcon", new IconUIResource(ei)); UIManager.put("Tree.collapsedIcon", new IconUIResource(ci)); UIManager.put("Tree.paintLines", paintLines.isSelected()); SwingUtilities.updateComponentTreeUI(this); }); JPanel p = new JPanel(new GridLayout(2, 1, 2, 2)); p.add(box1); p.add(box2); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); add(p, BorderLayout.NORTH); add(new JScrollPane(tree)); setPreferredSize(new Dimension(320, 240)); }
Example #26
Source File: LuckResourceBundle.java From littleluck with Apache License 2.0 | 4 votes |
protected IconUIResource getIconRes(Icon icon) { return new IconUIResource(icon); }
Example #27
Source File: LuckResourceBundle.java From littleluck with Apache License 2.0 | 4 votes |
protected IconUIResource getIconRes(String key) { return new IconUIResource(new ImageIcon(LuckRes.getImage(key))); }