📄 multievent1.java
字号:
import java.awt.*;
import java.awt.event.*;
public class MultiEvent1 extends Frame implements ActionListener, TextListener{
Label action=new Label();
Label text=new Label();
TextField tf=new TextField(20);
public MultiEvent1(String title){
super(title);
action.setBackground(Color.GREEN);
text.setBackground(Color.PINK);
add(action,"North");
add(text,"Center");
add(tf,"South");
tf.addActionListener(this);
tf.addTextListener(this);
}
public void actionPerformed(ActionEvent e){
action.setText(tf.getText());
}
public void textValueChanged(TextEvent e){
text.setText(tf.getText());
}
public static void main(String[] args){
Frame f=new MultiEvent1("促吝 捞亥飘 贸府");
f.pack();
f.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -