Swing之JFrame窗体

1 public class JFrameDemo extends JFrame{ 2 public void init() { 3 JFrame jf = new JFrame("guoguoguo"); 4 //获得一个容器 5 Container container= jf.getContentPane(); 6 container.setBackground(Color.red); 7 jf.setBounds(200, 200, 400, 500); 8 jf.setVisible(true); 9 Label label = new Label("hahahahahahahh"); 10 jf.add(label); 11 jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 12 13 14 }
浙公网安备 33010602011771号