Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Colorizing a Box

 
Dan Howard
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are Box's opaque? I'm betting not.
 
Dan Howard
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Opacity of course!
Thanks!
 
Brian Cole
Author
Ranch Hand
Posts: 903
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dan Howard
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good to know. But I'm on Java 6 so I should be good.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic