📄 testanonymous.java
字号:
//例12_12
import java.awt.*;
import java.awt.event.*;
public class TestAnonymous{
private Frame f=new Frame();
private TextArea text=new TextArea();
private Button b=new Button("Button");
private String fileName="";
public TestAnonymous(){
f.setLayout(new BorderLayout());
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}});
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String s=e.getActionCommand();
text.setText(s);
}});
b.setActionCommand("the Button was pressed");
f.add("North",b);
f.add("Center",text);
f.setSize(200,200);
f.setVisible(true);
}
public static void main(String args[]){
TestAnonymous ti=new TestAnonymous();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -