This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes cahnging color of Divider Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "cahnging color of Divider" Watch "cahnging color of Divider" New topic

cahnging color of Divider

Jain Neeraj
Ranch Hand

Joined: Aug 09, 2001
Posts: 35
How can I change the Color of the divider in a JSplitPane?
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
Hello Neeraj,
it depends on what kind of LAF you use. If you use the Java LAF, then it is easy. For this LAF, you can create themes. A theme consists of 6 colors and 6 fonts.
So you could write your own theme or you extend from the DefaultTheme and you can overwrite the color, which ontains the color for the divider.
The only problem is, you will change lots of other component colors too.
Another idea would be to go directly over JSplitPane.getUI(), which returns u a SplitPaneUI, which you probably can cast to a BasicSplitPaneUI. There you will find a function getDivider() and this is a Component, where you can set any Color.
Hope that helps

Jain Neeraj
Ranch Hand

Joined: Aug 09, 2001
Posts: 35
Thanks a lot, It worked!!!
I agree. Here's the link:
subject: cahnging color of Divider
It's not a secret anymore!