import java.awt.*;
import java.awt.event.*;
public class app13_1 extends Frame implements ActionListener{
static app13_1 frm = new app13_1();
static Button bt=new Button("设置字体颜色");
static TextArea ta = new TextArea("字体颜色",5,20);
public static void mian(String[] args){
bt.addActionListener(frm);
frm.setTitle("操作事件");
frm.setLayout(new FlowLayout());
frm.setSize(260,170);
frm.add(ta);
frm.add(bt);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e){
ta.setForeground(Color.red);
}
}
import java.awt.event.*;
public class app13_1 extends Frame implements ActionListener{
static app13_1 frm = new app13_1();
static Button bt=new Button("设置字体颜色");
static TextArea ta = new TextArea("字体颜色",5,20);
public static void mian(String[] args){
bt.addActionListener(frm);
frm.setTitle("操作事件");
frm.setLayout(new FlowLayout());
frm.setSize(260,170);
frm.add(ta);
frm.add(bt);
frm.setVisible(true);
}
public void actionPerformed(ActionEvent e){
ta.setForeground(Color.red);
}
}