?? testactionlistenerr.java
字號:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class testActionListenerr extends JFrame{
private JPanel jpanel1;
private JButton jb1=new JButton("按鈕");
public testActionListenerr(){
super("testActionListener");
setSize(300,100);
jpanel1=new JPanel();
jpanel1.add(jb1);
jb1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
log("按鈕被操作....");
log("命令字符串:"+e.getActionCommand());
log("事件發生時間:"+e.getWhen());
}
});
this.setContentPane(jpanel1);
}
public void log(String strInfo){
System.out.println(strInfo);
}
public static void main(String agg[]){
testActionListenerr ta1=new testActionListenerr();
ta1.show();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -