at java.awt.BorderLayout.addLayoutComponent(BorderLayout.java:463) at java.awt.BorderLayout.addLay 5
importjava.awt.Frame;importjava.awt.Panel;importjava.awt.Button;importjava.awt.GridLa...
import java.awt.Frame;
import java.awt.Panel;
import java.awt.Button;
import java.awt.GridLayout;
public class NestedContainter {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new Frame("NestedContainer");
Button b0 = new Button("display Area");
Panel p = new Panel();
p.setLayout(new GridLayout(2,2));
Button b1 = new Button("1");
Button b2 = new Button("2");
Button b3 = new Button("3");
Button b4 = new Button("4");
p.add(b1);;
p.add(b2);
p.add(b3);
p.add(b4);
f.add(b0, "North");
f.add(p, "Canter");
f.pack();
f.setVisible(true);
}
}
错在哪里 在线等 展开
import java.awt.Panel;
import java.awt.Button;
import java.awt.GridLayout;
public class NestedContainter {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new Frame("NestedContainer");
Button b0 = new Button("display Area");
Panel p = new Panel();
p.setLayout(new GridLayout(2,2));
Button b1 = new Button("1");
Button b2 = new Button("2");
Button b3 = new Button("3");
Button b4 = new Button("4");
p.add(b1);;
p.add(b2);
p.add(b3);
p.add(b4);
f.add(b0, "North");
f.add(p, "Canter");
f.pack();
f.setVisible(true);
}
}
错在哪里 在线等 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询