GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Colorizing a Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Colorizing a Box" Watch "Colorizing a Box" New topic
Author

Colorizing a Box

Dan Howard
Greenhorn

Joined: Oct 10, 2004
Posts: 15
Hi All,

I tried to use a Box in my BoxLayout and it lays out OK but I can't seem to change it's color. Any ideas?
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Are Box's opaque? I'm betting not.
Dan Howard
Greenhorn

Joined: Oct 10, 2004
Posts: 15
Opacity of course!
Thanks!
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
pete stein wrote:Are Box's opaque? I'm betting not.


One thing you might (or might not) have to worry about is that
until JDK4 Box wasn't even a Component. (It was a direct subclass
of Container.) As such, it doesn't have a setOpaque() method
when running under JDK1.3.1 or earlier: NoSuchMethodError

If this is a problem, you could instead set a BoxLayout on a JPanel.

bitguru blog
Dan Howard
Greenhorn

Joined: Oct 10, 2004
Posts: 15
Good to know. But I'm on Java 6 so I should be good.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Colorizing a Box