📄 e5_6.java
字号:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class E5_6 extends Applet implements TextListener,ActionListener{
TextArea text1,text2;Button button;
public void init()
{
text1 = new TextArea("",10,10);
text2 = new TextArea("",10,10);
button = new Button("确定");
add(text1);add(text2);add(button);
text1.addTextListener(this);
button.addActionListener(this);
}
public void textValueChanged(TextEvent e)
{
if (e.getSource() == text1)
{
text2.setText(text1.getText());
}
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == button)
{
text2.setText("我按了确定按钮");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -