Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In disabled mode, how do i make JList data to be in black color

 
Smriti Anchu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JList box in my application. In disabled mode the data in the list box looks embossed. (grey color). I want the list box to be in disabled mode but the font should be black in color. Does anybody know how to do this?

thanks
Smriti
 
KR Campbell
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 'look and feel' takes care of how list items are rendered. Probably, the solution would be to write a new ListCellRenderer to over-ride the default behaviour and then <code> setCellRenderer(myCellRenderer)</code>
 
Smriti Anchu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I added Cell renderer but even then it is not working.


But even then it didnt work....It is displaying in grey color only.

I also tried changing the default value by

Even with this it didnt work. Can u tell me whether the cellrendered class which i have written is correct or not.

If its not correct, can u give me some hints

thnx
smriti
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic