Java 类javax.swing.plaf.ComboBoxUI 实例源码

项目:cn1    文件:MetalCheckBoxUITest.java   
@Override
public void testInstallDefaults() {
    JCheckBox button = new JCheckBox();
    UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
    UIManager.put("CheckBox.focus", new ColorUIResource(Color.yellow));
    UIManager.put("CheckBox.select", new ColorUIResource(Color.green));
    UIManager.put("CheckBox.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("CheckBox.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("CheckBox.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("CheckBox.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("CheckBox.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:cn1    文件:MetalRadioButtonUITest.java   
public void testUninstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    publicUI.uninstallDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertNull("border", button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:cn1    文件:MetalRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:cn1    文件:BasicRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    assertNotNull("font is installed", button.getFont());
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Insets margin = new InsetsUIResource(10, 20, 30, 40);
    UIManager.put("RadioButton.margin", margin);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(ui);
    ui.installDefaults(button);
    assertEquals("background", Color.blue, button.getBackground());
    assertEquals("foreground", Color.cyan, button.getForeground());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("margin", margin, button.getMargin());
    assertEquals("icon", icon, ui.getDefaultIcon());
}
项目:freeVM    文件:MetalCheckBoxUITest.java   
@Override
public void testInstallDefaults() {
    JCheckBox button = new JCheckBox();
    UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
    UIManager.put("CheckBox.focus", new ColorUIResource(Color.yellow));
    UIManager.put("CheckBox.select", new ColorUIResource(Color.green));
    UIManager.put("CheckBox.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("CheckBox.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("CheckBox.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("CheckBox.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("CheckBox.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:MetalRadioButtonUITest.java   
public void testUninstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    publicUI.uninstallDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertNull("border", button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:MetalRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:BasicRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    assertNotNull("font is installed", button.getFont());
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Insets margin = new InsetsUIResource(10, 20, 30, 40);
    UIManager.put("RadioButton.margin", margin);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(ui);
    ui.installDefaults(button);
    assertEquals("background", Color.blue, button.getBackground());
    assertEquals("foreground", Color.cyan, button.getForeground());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("margin", margin, button.getMargin());
    assertEquals("icon", icon, ui.getDefaultIcon());
}
项目:freeVM    文件:MetalCheckBoxUITest.java   
@Override
public void testInstallDefaults() {
    JCheckBox button = new JCheckBox();
    UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
    UIManager.put("CheckBox.focus", new ColorUIResource(Color.yellow));
    UIManager.put("CheckBox.select", new ColorUIResource(Color.green));
    UIManager.put("CheckBox.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("CheckBox.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("CheckBox.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("CheckBox.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("CheckBox.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:MetalRadioButtonUITest.java   
public void testUninstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    publicUI.uninstallDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertNull("border", button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:MetalRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.disabledText", new ColorUIResource(Color.red));
    UIManager.put("RadioButton.focus", new ColorUIResource(Color.yellow));
    UIManager.put("RadioButton.select", new ColorUIResource(Color.green));
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:BasicRadioButtonUITest.java   
public void testInstallDefaults() {
    JRadioButton button = new JRadioButton();
    UIManager.put("RadioButton.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("RadioButton.background", new ColorUIResource(Color.blue));
    assertNotNull("font is installed", button.getFont());
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("RadioButton.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("RadioButton.border", border);
    Insets margin = new InsetsUIResource(10, 20, 30, 40);
    UIManager.put("RadioButton.margin", margin);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("RadioButton.icon", icon);
    button.setUI(ui);
    ui.installDefaults(button);
    assertEquals("background", Color.blue, button.getBackground());
    assertEquals("foreground", Color.cyan, button.getForeground());
    assertEquals("font", font, button.getFont());
    assertEquals("border", border, button.getBorder());
    assertEquals("margin", margin, button.getMargin());
    assertEquals("icon", icon, ui.getDefaultIcon());
}
项目:JRLib    文件:SubstanceLookAndFeel.java   
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
    if (icon == null)
        return null;
    SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities
            .getColorScheme(component, ComponentState.DISABLED_UNSELECTED);
    BufferedImage result = SubstanceImageCreator.getColorSchemeImage(
            component, icon, colorScheme, 0.5f);
    float alpha = SubstanceColorSchemeUtilities.getAlpha(component,
            ComponentState.DISABLED_UNSELECTED);
    if (alpha < 1.0f) {
        BufferedImage intermediate = SubstanceCoreUtilities.getBlankImage(
                result.getWidth(), result.getHeight());
        Graphics2D g2d = intermediate.createGraphics();
        g2d.setComposite(AlphaComposite.SrcOver.derive(alpha));
        g2d.drawImage(result, 0, 0, null);
        g2d.dispose();
        result = intermediate;
    }

    return new IconUIResource(new ImageIcon(result));
}
项目:JRLib    文件:SubstanceTreeUI.java   
@Override
protected void installDefaults() {
    super.installDefaults();
    if (SubstanceCoreUtilities.toDrawWatermark(this.tree))
        this.tree.setOpaque(false);

    if (this.tree.getSelectionPaths() != null) {
        for (TreePath selectionPath : this.tree.getSelectionPaths()) {
            TreePathId pathId = new TreePathId(selectionPath);
            selectedPaths.put(pathId, selectionPath.getLastPathComponent());
        }
    }

    setExpandedIcon(new IconUIResource(SubstanceIconFactory.getTreeIcon(
            this.tree, false)));
    setCollapsedIcon(new IconUIResource(SubstanceIconFactory.getTreeIcon(
            this.tree, true)));

    // instead of computing the cell renderer insets on
    // every cell rendering, compute it once and expose to the
    // SubstanceDefaultTreeCellRenderer
    this.cellRendererInsets = SubstanceSizeUtils
            .getTreeCellRendererInsets(SubstanceSizeUtils
                    .getComponentFontSize(tree));
}
项目:jdk8u-jdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:openjdk-jdk10    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:openjdk9    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:jdk8u_jdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:javify    文件:LookAndFeel.java   
/**
 * Utility method that creates a UIDefaults.LazyValue that creates an
 * ImageIcon UIResource for the specified gifFile filename.
 *
 * @param baseClass  the base class for accessing the icon resource.
 * @param gifFile  the file name.
 *
 * @return A {@link UIDefaults.LazyValue} that serves up an
 *     {@link IconUIResource}.
 */
public static Object makeIcon(Class<?> baseClass, String gifFile)
{
  final URL file = baseClass.getResource(gifFile);
  return new UIDefaults.LazyValue()
    {
      public Object createValue(UIDefaults table)
      {
        return new IconUIResource(new ImageIcon(file));
      }
    };
}
项目:jvm-stm    文件:LookAndFeel.java   
/**
 * Utility method that creates a UIDefaults.LazyValue that creates an
 * ImageIcon UIResource for the specified gifFile filename.
 * 
 * @param baseClass  the base class for accessing the icon resource.
 * @param gifFile  the file name.
 * 
 * @return A {@link UIDefaults.LazyValue} that serves up an 
 *     {@link IconUIResource}.
 */
public static Object makeIcon(Class<?> baseClass, String gifFile)
{
  final URL file = baseClass.getResource(gifFile);
  return new UIDefaults.LazyValue() 
    {
      public Object createValue(UIDefaults table)
      {
        return new IconUIResource(new ImageIcon(file));
      }
    };
}
项目:swingx    文件:SearchFieldAddon.java   
private IconUIResource getIcon(String resourceName) {
    URL url = getClass().getResource(resourceName);
    if (url == null) {
        return null;
    } else {
        return new IconUIResource(new ImageIcon(url));
    }
}
项目:swingx    文件:JXHeaderTest.java   
/**
 * Test that header's icon property set to default value, if any.
 */
@Test
public void testIconLabelDefaultUpdateD() {
    Icon uiDefault = UIManager.getIcon("Header.defaultIcon");
    Icon icon = new IconUIResource(XTestUtils.loadDefaultIcon());
    assertNotNull("sanity: default icon loaded", icon);
    JXHeader header = new JXHeader();
    header.setIcon(icon);
    assertSame(icon, getIconLabel(header).getIcon());
    SwingUtilities.updateComponentTreeUI(header);
    assertSame(uiDefault, header.getIcon());
    assertSame(uiDefault, getIconLabel(header).getIcon());
}
项目:infobip-open-jdk-8    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:jdk8u-dev-jdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:jdk7-jdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:openjdk-source-code-learn    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:java-swing-tips    文件:MainPanel.java   
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));
}
项目:OLD-OpenJDK8    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:cn1    文件:LookAndFeel.java   
public static Object makeIcon(final Class<?> c, final String path) {
    return new UIDefaults.LazyValue() {
        public Object createValue(final UIDefaults uiDefaults) {
            URL resource = c.getResource(path);
            return resource != null ? new IconUIResource(new ImageIcon(resource))
                                    : null;
        }
        public String toString() {
            return "Lazy Value: (lf) " + c.getName() + "  " + path;
        }
    };
}
项目:cn1    文件:MetalCheckBoxUITest.java   
@Override
public void testUninstallDefaults() {
    JCheckBox button = new JCheckBox();
    UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
    UIManager.put("CheckBox.focus", new ColorUIResource(Color.yellow));
    UIManager.put("CheckBox.select", new ColorUIResource(Color.green));
    UIManager.put("CheckBox.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("CheckBox.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("CheckBox.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("CheckBox.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("CheckBox.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    publicUI.uninstallDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertNull("border", button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:cn1    文件:BasicOptionPaneUITest.java   
public void testGetIconForType() throws InterruptedException {
    paneUI.optionPane = new JOptionPane();
    paneUI.optionPane.setUI(paneUI);
    Icon icon11 = new IconUIResource(new ImageIcon(new BufferedImage(10, 20,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon21 = new IconUIResource(new ImageIcon(new BufferedImage(30, 40,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon31 = new IconUIResource(new ImageIcon(new BufferedImage(50, 60,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon41 = new IconUIResource(new ImageIcon(new BufferedImage(70, 80,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("OptionPane.errorIcon", icon11);
    UIManager.put("OptionPane.informationIcon", icon21);
    UIManager.put("OptionPane.questionIcon", icon31);
    UIManager.put("OptionPane.warningIcon", icon41);
    Icon icon12 = paneUI.getIconForType(JOptionPane.ERROR_MESSAGE);
    Icon icon22 = paneUI.getIconForType(JOptionPane.INFORMATION_MESSAGE);
    Icon icon32 = paneUI.getIconForType(JOptionPane.QUESTION_MESSAGE);
    Icon icon42 = paneUI.getIconForType(JOptionPane.WARNING_MESSAGE);
    Icon icon52 = paneUI.getIconForType(JOptionPane.PLAIN_MESSAGE);
    Icon icon62 = paneUI.getIconForType(100);
    assertEquals(icon11, icon12);
    assertEquals(icon21, icon22);
    assertEquals(icon31, icon32);
    assertEquals(icon41, icon42);
    assertNull(icon52);
    assertNull(icon62);
    assertSame("icons are shared", icon12, paneUI.getIconForType(JOptionPane.ERROR_MESSAGE));
    assertSame("icons are shared", icon22, paneUI
            .getIconForType(JOptionPane.INFORMATION_MESSAGE));
    assertSame("icons are shared", icon32, paneUI
            .getIconForType(JOptionPane.QUESTION_MESSAGE));
    assertSame("icons are shared", icon42, paneUI
            .getIconForType(JOptionPane.WARNING_MESSAGE));
}
项目:JamVM-PH    文件:LookAndFeel.java   
/**
 * Utility method that creates a UIDefaults.LazyValue that creates an
 * ImageIcon UIResource for the specified gifFile filename.
 * 
 * @param baseClass  the base class for accessing the icon resource.
 * @param gifFile  the file name.
 * 
 * @return A {@link UIDefaults.LazyValue} that serves up an 
 *     {@link IconUIResource}.
 */
public static Object makeIcon(Class<?> baseClass, String gifFile)
{
  final URL file = baseClass.getResource(gifFile);
  return new UIDefaults.LazyValue() 
    {
      public Object createValue(UIDefaults table)
      {
        return new IconUIResource(new ImageIcon(file));
      }
    };
}
项目:JAVA_UNIT    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:tools-idea    文件:DarculaLaf.java   
private static Object parseValue(String key, @NotNull 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 = 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 = value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null;
    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;
}
项目:openjdk-jdk7u-jdk    文件:bug6604281.java   
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");
            }
        }
    });
}
项目:classpath    文件:LookAndFeel.java   
/**
 * Utility method that creates a UIDefaults.LazyValue that creates an
 * ImageIcon UIResource for the specified gifFile filename.
 *
 * @param baseClass  the base class for accessing the icon resource.
 * @param gifFile  the file name.
 *
 * @return A {@link UIDefaults.LazyValue} that serves up an
 *     {@link IconUIResource}.
 */
public static Object makeIcon(Class<?> baseClass, String gifFile)
{
  final URL file = baseClass.getResource(gifFile);
  return new UIDefaults.LazyValue()
    {
      public Object createValue(UIDefaults table)
      {
        return new IconUIResource(new ImageIcon(file));
      }
    };
}
项目:freeVM    文件:LookAndFeel.java   
public static Object makeIcon(final Class<?> c, final String path) {
    return new UIDefaults.LazyValue() {
        public Object createValue(final UIDefaults uiDefaults) {
            URL resource = c.getResource(path);
            return resource != null ? new IconUIResource(new ImageIcon(resource))
                                    : null;
        }
        public String toString() {
            return "Lazy Value: (lf) " + c.getName() + "  " + path;
        }
    };
}
项目:freeVM    文件:MetalCheckBoxUITest.java   
@Override
public void testUninstallDefaults() {
    JCheckBox button = new JCheckBox();
    UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
    UIManager.put("CheckBox.focus", new ColorUIResource(Color.yellow));
    UIManager.put("CheckBox.select", new ColorUIResource(Color.green));
    UIManager.put("CheckBox.foreground", new ColorUIResource(Color.cyan));
    UIManager.put("CheckBox.background", new ColorUIResource(Color.blue));
    Font font = new FontUIResource(button.getFont().deriveFont(100f));
    UIManager.put("CheckBox.font", font);
    Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    UIManager.put("CheckBox.border", border);
    Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("CheckBox.icon", icon);
    button.setUI(publicUI);
    publicUI.installDefaults(button);
    publicUI.uninstallDefaults(button);
    assertEquals(Color.blue, button.getBackground());
    assertEquals(Color.cyan, button.getForeground());
    assertEquals("SelectedColor ", Color.green, publicUI.getSelectColor());
    assertEquals("focusColor ", Color.yellow, publicUI.getFocusColor());
    assertEquals("disabledTextColor ", Color.red, publicUI.getDisabledTextColor());
    assertEquals("font", font, button.getFont());
    assertNull("border", button.getBorder());
    assertEquals("icon", icon, publicUI.getDefaultIcon());
}
项目:freeVM    文件:BasicOptionPaneUITest.java   
public void testGetIconForType() throws InterruptedException {
    paneUI.optionPane = new JOptionPane();
    paneUI.optionPane.setUI(paneUI);
    Icon icon11 = new IconUIResource(new ImageIcon(new BufferedImage(10, 20,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon21 = new IconUIResource(new ImageIcon(new BufferedImage(30, 40,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon31 = new IconUIResource(new ImageIcon(new BufferedImage(50, 60,
            BufferedImage.TYPE_INT_RGB)));
    Icon icon41 = new IconUIResource(new ImageIcon(new BufferedImage(70, 80,
            BufferedImage.TYPE_INT_RGB)));
    UIManager.put("OptionPane.errorIcon", icon11);
    UIManager.put("OptionPane.informationIcon", icon21);
    UIManager.put("OptionPane.questionIcon", icon31);
    UIManager.put("OptionPane.warningIcon", icon41);
    Icon icon12 = paneUI.getIconForType(JOptionPane.ERROR_MESSAGE);
    Icon icon22 = paneUI.getIconForType(JOptionPane.INFORMATION_MESSAGE);
    Icon icon32 = paneUI.getIconForType(JOptionPane.QUESTION_MESSAGE);
    Icon icon42 = paneUI.getIconForType(JOptionPane.WARNING_MESSAGE);
    Icon icon52 = paneUI.getIconForType(JOptionPane.PLAIN_MESSAGE);
    Icon icon62 = paneUI.getIconForType(100);
    assertEquals(icon11, icon12);
    assertEquals(icon21, icon22);
    assertEquals(icon31, icon32);
    assertEquals(icon41, icon42);
    assertNull(icon52);
    assertNull(icon62);
    assertSame("icons are shared", icon12, paneUI.getIconForType(JOptionPane.ERROR_MESSAGE));
    assertSame("icons are shared", icon22, paneUI
            .getIconForType(JOptionPane.INFORMATION_MESSAGE));
    assertSame("icons are shared", icon32, paneUI
            .getIconForType(JOptionPane.QUESTION_MESSAGE));
    assertSame("icons are shared", icon42, paneUI
            .getIconForType(JOptionPane.WARNING_MESSAGE));
}