import java.awt.*;
import java.awt.event.*;
class three extends Frame implements ActionListener{
static three frm=new three();
static Label l1=new Label();
static TextField m=new TextField();
public static void main(String[] args) {
// TODO Auto-generated method stub
frm.setTitle("窗口一");
frm.setSize(500,500);
frm.setLayout(new GridLayout(2,2));
l1.setText("标签一");
m.addActionListener(frm);
frm.add(l1);
frm.add(m);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
l1.setText(m.getText());
}
}
import java.awt.event.*;
class three extends Frame implements ActionListener{
static three frm=new three();
static Label l1=new Label();
static TextField m=new TextField();
public static void main(String[] args) {
// TODO Auto-generated method stub
frm.setTitle("窗口一");
frm.setSize(500,500);
frm.setLayout(new GridLayout(2,2));
l1.setText("标签一");
m.addActionListener(frm);
frm.add(l1);
frm.add(m);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
l1.setText(m.getText());
}
}