JFrame窗口的学习,不知道为什么可以运行,但不会有窗口弹出来,而直接在Netbeans里拽拉的运行却可以有窗口弹出,还要仔细查一查。
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.*;
public class JFrameExample extends JFrame{
public void JFrameExample(){
JLabel j1=new JLabel("hello,frame windows");
Container c=getContentPane();
c.add(j1);
setTitle("Jframe");
setSize(400,600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args){
new JFrameExample();
}
}