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