import java.awt.*;
import javax.swing.*;
public class Demo7_5 extends JFrame{
JPanel jp1,jp2;
JButton jb1,jb2,jb3,jb4,jb5,jb6;
public static void main(String[] args){
Demo7_5 demo7_5 = new Demo7_5();
}
public Demo7_5(){
//创建组件
jp1=new JPanel();
jp1=new JPanel();
jb1=new JButton("苹果");
jb2=new JButton("香蕉");
jb3=new JButton("橘子");
jb4=new JButton("桔子");
jb5=new JButton("梨子");
jb6=new JButton("黄连");
jp1.add(jb1);
jp1.add(jb2);
jp2.add(jb3);
jp2.add(jb4);
jp2.add(jb5);
this.add(jp1,BorderLayout.NORTH);
this.add(jb6,BorderLayout.CENTER);
this.add(jp2,BorderLayout.SOUTH);
this.setTitle("多布局案例");
this.setSize(200,200);
this.setLocation(300,200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//显示
this.setVisible(true);
}
}
那个地方错了?