import javax.swing.*;
import java.awt.*;
public class TestGridLayout{
public static void main(String args[]){
JFrame win=new JFrame("窗体");
win.setBounds(200,200,600,600);
win.setVisible(true);
JButton bSouth=new JButton("南"),
bNorth=new JButton("北"),
bEast =new JButton("东"),
bWest =new JButton("西");
JPanel bCenter=new JPanel();
win.add(bNorth,BorderLayout.NORTH);
win.add(bSouth,BorderLayout.SOUTH);
win.add(bEast,BorderLayout.EAST);
win.add(bWest,BorderLayout.WEST);
win.add( bCenter,BorderLayout.CENTER);
JButton b[];
bCenter.setLayout(new Gridlayout(3,3,5,5));//一直在这报错java.awt.Gridlayout cannot be resolved to a type
b=new JButton[9];
for(int i=0;i<b.length;i++){
b[i]=new JButton(""+i);
bCenter.add(b[i]);
}
win.validate();
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
求高手解决,,,,,
这不知道就查一下 API不就懂了么