Tip for comboboxes on readOnly forms

In the default LAFs, if you put a form in readOnly mode (form.controller.readOnly = true) then an annoying thing happens to your comboboxes - they become difficult to read because they become grey text against a grey background like so:

[attachment=1]4-29-2010 2-23-52 PM.png[/attachment]

This is the OS’s way of signalling to the user that the combobox is not ‘active’ at the moment. It would be nice if we could achieve that without making the data hard to read. Well Sanneke Aleman sent me this line of code which ensures that the text will remain black even if the background goes gray:

application.setUIProperty("ComboBox.disabledForeground", new Packages.javax.swing.plaf.ColorUIResource(java.awt.Color.BLACK));

Now the comboboxes on a readOnly form look like this:

[attachment=0]4-29-2010 2-30-09 PM #2.png[/attachment]

Much better! Thank you Sanneke!

4-29-2010 2-30-09 PM #2.png

4-29-2010 2-23-52 PM.png

Thanks Adrian (and Sanneke)!

And for those who want to know better all the available Look & Feel propeties and their default values (for each L&F), I just made a small utilities that will help.
Check out the FAQ section of the Servoy-Stuff site.

ptalbot:
Thanks Adrian (and Sanneke)!

And for those who want to know better all the available Look & Feel propeties and their default values (for each L&F), I just made a small utilities that will help.
Check out the FAQ section of the Servoy-Stuff site.

Nice! Thanks Patrick! :D

Some additional notes on usage and what you can do. I think most of it is still valid:

viewtopic.php?f=12&t=12767