UIManager.put("Label.font", new Font("Dialog", Font.PLAIN, 21));
UIManager.put("Label.foreground", Color.green);
UIManager.put("Label.background", Color.yellow);
MyBasicComboBoxUI ui = new MyBasicComboBoxUI();
ListCellRenderer renderer = ui.createRenderer();
Component c = (Component) renderer;
harness.check(c.getFont(), new Font("Dialog", Font.PLAIN, 21));
harness.check(c.getForeground(), Color.green);
harness.check(c.getBackground(), Color.yellow);
// confirm that the method creates a new instance every time
ListCellRenderer renderer2 = ui.createRenderer();
harness.check(renderer != renderer2);
JComboBox cb = new JComboBox();
ListCellRenderer renderer3 = cb.getRenderer();
Component c3 = (Component) renderer3;
harness.check(c3.getFont(), new Font("Dialog", Font.PLAIN, 21));
harness.check(c3.getForeground(), Color.green);
harness.check(c3.getBackground(), Color.yellow);
// changing the font on the combo box doesn't update the renderer font
cb.setFont(new Font("Dialog", Font.BOLD, 10));
harness.check(c3.getFont(), new Font("Dialog", Font.PLAIN, 21));
ListCellRenderer renderer4 = cb.getRenderer();
harness.check(renderer3 == renderer4);
// restore a sane look and feel
try
{