File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to change color of SplitPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to change color of SplitPane?" Watch "How to change color of SplitPane?" New topic
Author

How to change color of SplitPane?

Matt Wil
Greenhorn

Joined: Apr 05, 2004
Posts: 23
Hi,
I am trying to change the color of my java applet.. I am able to change everything except the color of the divider bar in my SplitPane. I read about using this inside the splitpane:

setBackground(Color.RED);

This only changes a thin line at the very top of the divider bar to red. How do I change the entire divider bar to a color?

I have already tried this with the same results as above:

((BasicSplitPaneUI)mySplitPane.getUI()).getDivider().setBackground(Color.RED);

Thanks!
Jeffrey Bennett
Greenhorn

Joined: May 17, 2004
Posts: 12
I have a custom splitpane widget tricked out for n-way splits, and needed to juice the divider (color, extra widgets, etc.) Some of this may help.

You need to setBackground on both the JSplitPane, as well as the divider. In my extension of JSplitPane, I just overrode setBackground(...) to invoke super, then get the divider (as you wrote) and do a divider.setBackground(...)

I also seem to have extended BasicSplitPaneDivider such that setBackground(...) on this would get applied to the leftButton and rightButton too.
 
wood burning stoves
 
subject: How to change color of SplitPane?
 
Similar Threads
how to change the background color of Buttons in a JPanel?
changing background color of JFrame
setDividerLocation
cahnging color of Divider
JSplitPane and DividerLocation