package GUI;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Fangfa {
private Frame f;
private TextField t;
private TextArea ta;
private Button s;
Fangfa()
{
Frame f=new Frame("....");
f.setSize(300,400);
f.setLocation(600,300);
f.setLayout(new FlowLayout());
Button s=new Button("ok");
TextField t=new TextField(10);
TextArea ta=new TextArea(15,20);
f.add(t);
f.add(s);
f.add(ta);
f.setVisible(true);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
s.addMouseListener(new MouseAdapter() {
//int count=1;
//int count1=1;
public void mouseClicked(MouseEvent e){
//System.out.println("点击第"+(count++)+"下");
String a=t.getText() ;
// ta.append(a);
System.out.println(a);
}
});
t.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e)
{
}
});
}
private void zhuanhuan()
{
String a=t.getText() ;
// ta.append(a);
System.out.println(a);
}
}
|