[英]Java how to start up the GUI made with IntelliJ IDEA
我已经使用IntelliJ-IDEA制作了一个简单的GUI,但我不知道如何启动它。 如Form1 f = new Form();
我的main()
函数内部似乎什么也没做。 有谁知道如何启动它?
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
Form1 t = new Form1();
}
}
我不得不多加几行,超出预期。 这是Form1.java
文件的工作代码。 我没有更改main()
功能。
public class Form1 extends JFrame {
// ******** These are just auto-generated from the IDE ********
private JPanel panel1;
private JButton button1;
private JButton bb137;
private JButton button3;
private JButton button4;
private JButton button5;
private JButton button6;
private JButton button7;
private JCheckBox checkBox1;
private JRadioButton radioButton1;
private JRadioButton radioButton2;
private JRadioButton radioButton3;
// ************************************************************
public Form1(){
super("Whatever form title here.");
// panel1 is my main panel as you can see in my question's screenshot
setContentPane(panel1);
//x , y, width, height
setBounds(300,300,600,600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.