- 论坛徽章:
- 0
|
import java.awt.*;
import java.awt.event.*;
public class hellofram{
public static void main(String[] args){
skd shm=new skd();
shm.sky();
}
}
class skd implements ActionListener{
Frame frame=new Frame("Hello");
frame.setLayout(new GridLayout(1,1)); //11 行
frame.setSize(100,100); //12行
frame.setVisible(true); //13行
//frame.pack();
Button b1=new Button("确定");
Button b2=new Button("取消");
TextField tf=new TextField(10);
public void sky(){
frame.add(b1);
frame.add(b2);
frame.add(tf);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==b1)
tf.setText("I love you ");
}
}
F:\javaxuexi\java\习题\hellofram.java:12: 需要 <标识符>
frame.setSize(100,100);
11,13,行也是. |
|