哪位帮帮忙啊要对的啊
来源:百度知道 编辑:UC知道 时间:2024/06/01 18:57:38
//会将右边(东部)选中文本复制到左边(西部)文本框
//又帮楼主改了下,现在是BorderLayout了。
import java.awt.*;
import java.awt.event.*;
import java.awt.Component;
public class SelectWord extends Frame {
Button b = new Button("AddText");
double heigth, weigth;
double x, y;
TextField tf1 = new TextField(null, 10);
TextField tf2 = new TextField(null, 10);
public SelectWord() {
super("挑单词");
setLayout(new BorderLayout());
this.add(tf1,BorderLayout.WEST);
this.add(tf2,BorderLayout.EAST);
this.add(b,BorderLayout.SOUTH);
pack();
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
b.addActionListener(new ButtonListener());
}
class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
i