下面列出了怎么用javax.swing.plaf.IconUIResource的API类实例代码及写法,或者点击链接到github查看源代码。
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
}
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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");
}
}
});
}
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));
}
@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();
}
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;
}
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;
}
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;
}
protected IconUIResource getIconRes(String key)
{
return new IconUIResource(new ImageIcon(LuckRes.getImage(key)));
}
protected IconUIResource getIconRes(Icon icon)
{
return new IconUIResource(icon);
}
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));
}
@Override
public Icon getDefaultIcon() {
return new IconUIResource(EmptyIcon.create(20));
}
@Override
public Icon getDefaultIcon() {
return new IconUIResource(EmptyIcon.create(20));
}
@Override
public Icon getDefaultIcon() {
return new IconUIResource(JBUI.emptyIcon(20));
}
@Override
public Icon getDefaultIcon() {
return new IconUIResource(JBUI.emptyIcon(20));
}
@Override
public Icon getDefaultIcon() {
return new IconUIResource(JBUI.emptyIcon(20));
}