Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to change color of SplitPane?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic