Bem, depois de muita luta, fiz uma classe que estende a BasicComboBoxUI e deixei que o foreground nao veja se esta disable. Ele pega direto a cor usada como padrao na combo.
Segue abaixo o codigo da classe para quem tiver curioso em como implementar…
class ComboUI extends BasicComboBoxUI{//javax.swing.plaf.metal.MetalComboBoxUI{
/**
* Paints the currently selected item.
*/
public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
ListCellRenderer renderer = comboBox.getRenderer();
Component c;
if ( hasFocus && !isPopupVisible(comboBox) ) {
c = renderer.getListCellRendererComponent( listBox,
comboBox.getSelectedItem(),
-1,
true,
false );
}
else {
c = renderer.getListCellRendererComponent( listBox,
comboBox.getSelectedItem(),
-1,
false,
false );
}
c.setFont(comboBox.getFont());
c.setForeground(comboBox.getForeground());
if( hasFocus )
c.setBackground(new java.awt.Color(235, 230, 200));
else
c.setBackground(java.awt.Color.WHITE);
// Fix for 4238829: should lay out the JPanel.
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 paint( Graphics g, JComponent c ) {
super.paint(g,c);
}
/**
* Creates an button which will be used as the control to show or hide
* the popup portion of the combo box.
*
* @return a button which represents the popup control
*/
protected JButton createArrowButton() {
JButton botao = super.createArrowButton();
botao.setMargin(new Insets(0,0,0,0));
botao.setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
botao.setBorderPainted(false);
botao.setFocusPainted(false);
botao.setContentAreaFilled(false);
botao.setFocusable(false);
return botao;
}
}
No forum da sun teve algumas dicas de como fazer tb.