@Override public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); //Fix for an obscure condition when renderer may be null - //can't figure how this can happen unless the combo box is //painted before installUI() has completed (which is called //by the superclass constructor calling updateUI(). Only //happens when opening an individual Properties window. Maybe //the window is constructed off the AWT thread? if ((listBox == null) || (renderer == null)) { return; } Component c; c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false); c.setFont(comboBox.getFont()); c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : PropUtils.getDisabledForeground()); c.setBackground(comboBox.getBackground()); boolean shouldValidate = false; if (c instanceof JPanel) { shouldValidate = true; } currentValuePane.paintComponent( g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, shouldValidate ); }
public void paintCurrentValue(Graphics g, Rectangle bounds,boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); //Fix for an obscure condition when renderer may be null - //can't figure how this can happen unless the combo box is //painted before installUI() has completed (which is called //by the superclass constructor calling updateUI(). Only //happens when opening an individual Properties window. Maybe //the window is constructed off the AWT thread? if ((listBox == null) || (renderer == null)) { return; } Component c; c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false ); c.setFont(comboBox.getFont()); c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : PropUtils.getDisabledForeground()); c.setBackground(comboBox.getBackground()); boolean shouldValidate = false; if (c instanceof JPanel) { shouldValidate = true; } currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y, bounds.width,bounds.height, shouldValidate); }
public void paintCurrentValue(Graphics g, Rectangle bounds,boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); //Fix for an obscure condition when renderer may be null - //can't figure how this can happen unless the combo box is //painted before installUI() has completed (which is called //by the superclass constructor calling updateUI(). Only //happens when opening an individual Properties window. Maybe //the window is constructed off the AWT thread? if ((listBox == null) || (renderer == null)) { return; } Component c; c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false ); c.setFont(comboBox.getFont()); c.setForeground(comboBox.isEnabled() ? comboBox.getForeground() : PropUtils.getDisabledForeground()); c.setBackground(comboBox.getBackground()); boolean shouldValidate = false; if (c instanceof JPanel) { shouldValidate = true; } currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y, bounds.width,bounds.height, shouldValidate); }