LnF: custom selection colors

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

LnF: custom selection colors

Postby Loic Garreau » Thu Jan 28, 2010 7:57 am

Hi all,

1. What would be the most convenient way to change the default LnF selection color (by default, it's in "inverse video": foreground = white, background=kind of a dark blue) ? This applies to all the Jide LnF except the "Vs Net " one.

2. I use
Code: Select all
 CommandBarFactory.createLookAndFeelMenu()
in order to create the menu with the look and feels. My application has a couple of graphic components which are singletons and when I change the LnF from the menu these components are not updated ==> what would be the "cleanest" way to do this ?

Thank you.
Loic
Loic Garreau
 
Posts: 3
Joined: Mon May 04, 2009 7:13 am

Re: LnF: custom selection colors

Postby JIDE Support » Thu Jan 28, 2010 10:52 am

1, As far as I know, the most convenient way should be change the UIDefaults. You need try and get what exact key you want to change first.
2, It depends on how you paint your graphic components. If you get the buttons, colors from the UIDefaults, it should be changed as well. A test case would help.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: LnF: custom selection colors

Postby Loic Garreau » Fri Jan 29, 2010 2:59 am

Thanks for your answer !

1. It works. But there are other components which are using the inverse video and I would like to change this too. I could, e.g., use
Code: Select all
   uiDefaults.put("Table.selectionForeground", new ColorUIResource(Color.BLACK));
   uiDefaults.put("Table.selectionBackground", new ColorUIResource(new Color(0.0f,0.1f,0.7f,0.25f)));
for the JTable. I know one can turn off bold fonts for *all* the components with just one line:
Code: Select all
   UIManager.put("swing.boldMetal", Boolean.FALSE);
and I'm wondering if there exists some similar quick way for the colors...

2. I think (didn't verify this, though) that the action performed when one switches the LnF from the Jide menu calls something like
Code: Select all
SwingUtilities.updateComponentTreeUI(rootComponent);
==> jide is *not* aware of my singletons, so it updates only the rootComponent (the main frame hierarchy). But probably it is a bad idea to have singletons (I need them in order to accelerate the display)...
Loic Garreau
 
Posts: 3
Joined: Mon May 04, 2009 7:13 am

Re: LnF: custom selection colors

Postby Loic Garreau » Fri Jan 29, 2010 3:31 am

I solved #2 above by adding a propertyChangeListener to the UIManager (I update all my singetons each time there is a change in the LnF). I'm still fighting with #1.
Loic Garreau
 
Posts: 3
Joined: Mon May 04, 2009 7:13 am

Re: LnF: custom selection colors

Postby JIDE Support » Fri Jan 29, 2010 9:56 am

Regarding the issue #1, it's frustrating to figure out which color is decided by which property key in Swing. However it's our life. Good luck on your surfing. :)

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 65 guests