我正在使用这个特定的LookAndFeel:
PlasticLookAndFeel.setPlasticTheme(new com.jgoodies.looks.plastic.theme.SkyBluer());
UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.PlasticLookAndFeel());
我使用此代码设置可编辑的JComboBox命名组件的背景:
ComboBoxEditor editor = component.getEditor();
JTextField textField = (JTextField) editor.getEditorComponent();
textField.setBackground(color);
结果是:
如果我对不可编辑的组合框使用相同的代码,则不会发生任何事情:
如果我将此代码用于不可编辑的组合框:
((JComboBox)component).setBackground(color);
结果是颜色外推了组件大小。像这个图:
1)有没有人知道如何设置不可编辑组合框的背景而不推断这个特定LookAndFell的大小?