SWT detecting system color changes

Posted on 2004-10-25
Last Modified: 2008-01-09
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?
Question by:radixk
    LVL 9

    Expert Comment

    Yeah, you'll probably need to create a Thread to keep checking the system colours, and if they change, it updates the CTabFolder.


    Author Comment

    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.
    LVL 9

    Expert Comment

    Sounds nice ;)

    Go here:

    And request a thread deletion and refund of points :)

    best of luck for the future

    Accepted Solution

    Question answered by asker or dialog valuable.
    Closed, 250 points refunded.
    ee_ai_construct (replacement part #xm34)
    Community Support Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now