Faiq Irfan
Faiq Irfan

Reputation: 181

Is there any method in java which returns the system's theme color?

I am currently working on a JFrame which is to be set to fullscreen by the user. When in fullscreen, the title bar has to be removed by the JFrame's setUndecorated() method. However doing this deprives the user of the title bar. So I added a JPanel named titleBar at the top which appears only when the cursor is very close to the JFrame's top. Now the problem is that I want the titleBar's color to be the same as the user has set in his System's settings. I have tried to find a method in the System and Toolkit classes but it didn't help. Can anyone tell me if there is a method in java that returns me the current System's title bar color. Any help will be appreciated. Thanks for the attention.

Upvotes: 0

Views: 646

Answers (1)

tsolakp
tsolakp

Reputation: 5948

Use UIManager.getColor(key). You have to find the appropriate key for your needs. See this other post for more on the keys:

Swing UIManager.getColor() keys

Upvotes: 1

Related Questions