为什么我这个程序 不能设置页面的大小 和Panel的大小???我想在下面那个textarea旁边 加个button怎么做啊???
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.net.*;
import java.io.*;
public class d1 {
public static void main(String[] args) {
frame f = new frame("哈哈");
}
}
class frame extends Frame {
frame(String s){
super(s);
this.setLayout(new GridLayout(3,0));
Panel p1 = new Panel();
Panel p2 = new Panel();
Panel p3 = new Panel();
add(p1);
add(p2);
add(p3);
TextArea t1 = new TextArea("hello",20,30);
TextArea t2 = new TextArea("222",20,30);
Label l = new Label("hhh");
p1.add(t1);
p2.add(l);
p3.add(t2);
t1.setSize(700, 600);
t2.setSize(700, 50);
this.setSize(700, 700);
this.pack();
A a = new A ();
this.addWindowListener(a);
this.setVisible(true);
}
}
class A extends WindowAdapter {
public void windowClosing(WindowEvent e){
System.exit(1);
}
}
|