import javax.swing.*;
import java.awt.*;public class Testit extends JFrame{
JButton b=new JButton("test");
JButton b2=new JButton("test2");
public Testit(){
setSize(200,200);
Container cp=this.getContentPane();
this.setLayout(new FlowLayout());
cp.add(b);cp.add(b);cp.add(b2);
this.setVisible(true);
}
public static void main(String[] args){
new Testit();
}
}这段程序运行的时候,Button b只能显示一个,怎么才能让他显示出两个??谢谢!!
import java.awt.*;public class Testit extends JFrame{
JButton b=new JButton("test");
JButton b2=new JButton("test2");
public Testit(){
setSize(200,200);
Container cp=this.getContentPane();
this.setLayout(new FlowLayout());
cp.add(b);cp.add(b);cp.add(b2);
this.setVisible(true);
}
public static void main(String[] args){
new Testit();
}
}这段程序运行的时候,Button b只能显示一个,怎么才能让他显示出两个??谢谢!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货