Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.
Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg
I have tried the following code on Swing Designer v6.4.0 and v6.4.1(eclipse 3.2 and 3.3).
JPanel jp = new JPanel();
final JButton button = new JButton("button");
button.setPreferredSize(new Dimension(111, 111));
However, non of the versions work for the button.setBackground(Color.BLACK);.It seems just the border color has been changed to black. I am wondering if this is a bug of swing designer? I tried JPanel and JRadioButton, they works for setBackground method...
Looking forward to hearing your reply.
- Posts: 1
- Joined: Wed Oct 03, 2007 4:10 pm
The background color of the button depends entirely on which Look & Feel you are using. Swing's standard Windows L&F emulates Windows standard behavior which sets a buttons background based on the current Windows theme. Other L&F's like Metal and Motif will show the background color.
So...no, this is not a bug. It is working exactly like expected given this "feature" of Sun's underlying Swing implementation.
- Posts: 4503
- Joined: Tue Sep 30, 2003 6:39 am
- Location: Boston, MA USA
Return to Swing Designer
Who is online
Users browsing this forum: No registered users and 1 guest