|
-
February 1st, 1999, 01:24 PM
#1
How to change default background color?
Has anybody had any luck with changing the default background color? Looking
through the O'Reilly Java Swing book, it appears that all I have to do is
UIManager.put("window", Color.green). I did that before and after switching to the system L&F, but didn't see any effect. I also tried to just set the default background color for buttons by UIManager.put("Button.background", Color.green) and also didn't see any effect. Any ideas?
Thanks,
Neil Weber
[email protected]
-
August 12th, 1999, 09:10 PM
#2
Re: How to change default background color?
Try c.setBackground(Color) where c is an instance of a component and Color is an instance of Color
Van Glass
<a href="http://www.jscape.com">http://www.jscape.com</a>
-
August 13th, 1999, 12:20 AM
#3
Re: How to change default background color?
I also tried it both on JDK1.1.5 and JDK1.2. I didn't get green color for the frame, but I got color of button as green.
import java.awt.*;
//import com.sun.java.swing.*;
import javax.swing.*;
public class rnd
extends JPanel
{
public rnd()
{
super( new BorderLayout() );
setOpaque( true );
add( new JLabel("hi"), BorderLayout.CENTER );
add( new JButton("HI"), BorderLayout.NORTH );
}
public static void main( String args[] )
{
UIManager.put("Window",Color.green);
UIManager.put("Button.background",Color.green);
JFrame jf = new JFrame();
jf.setSize(100,100);
jf.setContentPane( new rnd() );
jf.show();
}
}
- UnicMan
http://members.tripod.com/unicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|