• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 960
  • Last Modified:

SWT detecting system color changes

I have a SWT app using the CTabFolder and I am setting it's color to a gradient based on the system colors.  It works perfectly and looks great.

The problem is that when the system colors are changed after the control is created it doesn't update the CTabFolder colors.  I think I need to add a listener to the display object but I can't seem to figure out what it is I should be listening for.  Also, since the tabs are created at runtime on demand, how would I loop through them and change the colors when the listener is fired?
  • 2
1 Solution
Yeah, you'll probably need to create a Thread to keep checking the system colours, and if they change, it updates the CTabFolder.

radixkAuthor Commented:
I figured this one out.

I created a Hashtable at startup and placed the current system colors in it.  I then created a paint listener in the CTabFolder and then compared the Hashtable to the current system colors.  If they're different, I set the colors and then update the hashtable with the current colors.

Works perfect.
Sounds nice ;)

Go here: www.experts-exchange.com/Community_Support/

And request a thread deletion and refund of points :)

best of luck for the future
Question answered by asker or dialog valuable.
Closed, 250 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now