/** * Sets the Icon to use for the handle of a collapsed node. * * Note: this will only succeed if the current ui delegate is * a BasicTreeUI otherwise it will do nothing. * * PENDING JW: incomplete api (no getter) and not a bound property. * * @param collapsedIcon the Icon to use for the handle of a collapsed node. */ public void setCollapsedIcon(Icon collapsedIcon) { if (getUI() instanceof BasicTreeUI) { ((BasicTreeUI) getUI()).setCollapsedIcon(collapsedIcon); } }
/** * Sets the Icon to use for the handle of a collapsed node. * * Note: this will only succeed if the current ui delegate is * a BasicTreeUI otherwise it will do nothing. * * PENDING JW: incomplete api (no getter) and not a bound property. * * @param collapsedIcon the Icon to use for the handle of a collapsed node. */ public void setCollapsedIcon(Icon collapsedIcon) { if (getUI() instanceof BasicTreeUI) { ((BasicTreeUI) getUI()).setCollapsedIcon(collapsedIcon); } }
/** * Sets the Icon to use for the handle of a collapsed node. * * Note: this will only succeed if the current ui delegate is * a BasicTreeUI otherwise it will do nothing. * * PENDING JW: incomplete api (no getter) and not a bound property. * * @param collapsedIcon the Icon to use for the handle of a collapsed node. */ public void setCollapsedIcon(Icon collapsedIcon) { if (getUI() instanceof BasicTreeUI) { ((BasicTreeUI) getUI()).setCollapsedIcon(collapsedIcon); } }
/** * Sets the Icon to use for the handle of a collapsed node. * * Note: this will only succeed if the current ui delegate is * a BasicTreeUI otherwise it will do nothing. * * PENDING JW: incomplete api (no getter) and not a bound property. * * @param collapsedIcon the Icon to use for the handle of a collapsed node. */ public void setCollapsedIcon(Icon collapsedIcon) { if (getUI() instanceof BasicTreeUI) { ((BasicTreeUI) getUI()).setCollapsedIcon(collapsedIcon); } }
/** * Sets the Icon to use for the handle of a collapsed node. * * Note: this will only succeed if the current ui delegate is * a BasicTreeUI otherwise it will do nothing. * * PENDING JW: incomplete api (no getter) and not a bound property. * * @param collapsedIcon the Icon to use for the handle of a collapsed node. */ public void setCollapsedIcon(Icon collapsedIcon) { if (getUI() instanceof BasicTreeUI) { ((BasicTreeUI) getUI()).setCollapsedIcon(collapsedIcon); } }
treeUI.setCollapsedIcon(ResourceUtil.getImageIcon("info/aduna/swing/config/collapsed.png")); treeUI.setExpandedIcon(ResourceUtil.getImageIcon("info/aduna/swing/config/expanded.png"));
public void constructTree(DefaultTreeModel model) { this.setModel(model); this.setShowsRootHandles(true); this.setRootVisible(false); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); ImageIcon plus = new ImageIcon(getClass().getResource("/icon/plusTree.png")); //$NON-NLS-1$ ImageIcon minus = new ImageIcon(getClass().getResource("/icon/minusTree.png")); //$NON-NLS-1$ ComponentUI ui = this.getUI(); if (ui instanceof BasicTreeUI) { ((BasicTreeUI) ui).setExpandedIcon(minus); ((BasicTreeUI) ui).setCollapsedIcon(plus); } renderer.setOpenIcon(null); renderer.setClosedIcon(null); renderer.setLeafIcon(null); this.setCellRenderer(renderer); }
tree.setUI(tUI); try { tUI.setCollapsedIcon(new ImageIcon(new URL("https://i.stack.imgur.com/nKJFv.png"))); tUI.setExpandedIcon(new ImageIcon(new URL("https://i.stack.imgur.com/NJvcp.png"))); tUI.setRolloverIcon(new ImageIcon(new URL("https://i.stack.imgur.com/jN6uX.png")));
BufferedImage collapsedIcon = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); collapsedIconPainter.paint(collapsedIcon.createGraphics(), null, size, size); basicUI.setCollapsedIcon(new ImageIcon(collapsedIcon)); basicUI.setExpandedIcon(new ImageIcon(expandedIcon));
BufferedImage collapsedIcon = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); collapsedIconPainter.paint(collapsedIcon.createGraphics(), null, size, size); basicUI.setCollapsedIcon(new ImageIcon(collapsedIcon)); basicUI.setExpandedIcon(new ImageIcon(expandedIcon));