Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Weird Problem JComboBox  RSS feed

Kinu Kanwar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on quite complex GUI project and we have almostly customzied every Component class.

I am facing very weird problem which I have never faced.

I have combo box on screen and It is enabled and non editable.

Programmitcally I do some complex things and populate it. The thing is that the elements in combo box are of grey color instead of default black color. I have checked my renderer classes etc and till now it was working fine but I add some new functionalty in my GUI and I came up with this problem.

I did not make any changes to my combo box class or its related classes. I just add new component on my screen,

If I add

JOptionPane.showMessageDialog(null, "444", "44444", JOptionPane.ERROR_MESSAGE);

as last line of function which populates combo box, combo box elements turn into black again.

I have tried repaint() , validate() and pack() on my frame but nothing works even I have called explicitly setForeground(Color.BLACK) on my combo box. it does not help. Can some one help me why elements are turning into grey and how they turn into black again after putting above java line.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!