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 Colorizing a Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
Similar Threads
deadlocks
Can't control BoxLayout when adding JTableHeader
BoxLayout
Making Typing "Game", any tips or pointers before I start?
Why aren't my components wrapping?