?? main.java
字號:
package main;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Main extends JFrame implements ActionListener{
JButton jbs;
JButton jbadd;
JButton jexit;
public Main(){
init();
}
private void init() {
this.setLayout(null);
jbs=new JButton("查詢所有學生信息" );
jbadd=new JButton("添加學生信息");
jexit=new JButton("退出");
jbs.setBounds(50,40,150,40);
jbadd.setBounds(210,40,150,40);
this.jbs.addActionListener(this);
this.jbadd.addActionListener(this);
this.jexit.addActionListener(this);
this.add(jbs);
this.add(jbadd);
this.add(jexit);
this.setTitle("主窗體");
this.setSize(400,300);
this.setLocationRelativeTo(this);
this.setVisible(true);
this.setResizable(false);
}
public void actionPerformed(ActionEvent arg0) {
String s=arg0.getActionCommand();
if(s.equals("退出")){
System.exit(0);
}else if(s.equals("查詢所有學生信息")){
new LookupAllStudents();
}else{
new AddStudent();
}
}
public static void main(String []args){
new Main();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -