[英]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.