问题
I like to change the UI of a JComboBox from the default metal look to some custom UI, see attached image.
I have tried changing all the UIDefaults for the JComboBox but to no success.
How does one achieve this?
jdk1.4.2
回答1:
You have to write your own ComboBoxUI class. I suggest to look at either Synth or Nimbus Look and Feel to make it easier.
回答2:
you need to change arrow image , and in style change background for this JComboBox !
回答3:
use WindowsLookAndFeel;
this works if and only if you are running your application in winows;
in your main you can do this before creating any UI:
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception ignore){
}
来源:https://stackoverflow.com/questions/1026559/how-do-i-change-the-ui-of-a-jcombobox