Java常用组件与布局

public class Example9_4
{
public static void main(String args[ ]) {
new ShowLayout( );
}
}

import java.awt.;
import javax.swing.
;
public class ShowLayout extends JFrame {
PanelGridLayout pannelGrid;
PanelNullLayout panelNull;
JTabbedPane p;
ShowLayout() {
pannelGrid=new PanelGridLayout();
panelNull=new PanelNullLayout();
p = new JTabbedPane();
p.add(“网格布局的面板”,pannelGrid);
p.add(“空布局的面板”,panelNull);
add(p,BorderLayout.CENTER);
add(new JButton(“窗体是BorderLayout布局”),BorderLayout.NORTH);
add(new JButton(“南”),BorderLayout.SOUTH);
add(new JButton(“西”),BorderLayout.WEST);
add(new JButton(“东”),BorderLayout.EAST);
setBounds(10,10,570,390);
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
validate();
}
}

import java.awt.;
import javax.swing.
;
import java.awt.GridLayout;
import java.awt.Label;
public class PanelGridLayout extends JPanel {
PanelGridLayout( ) {
GridLayout grid=new GridLayout(12,12);
setLayout(grid);
Lable [ ][ ] label=new Label [12][12];
for(int i=0;i<12;i++) {
for(int j=0;j<12;j++) {
label [i][j]=new Label();
if((i+j)%2==0)
label[i][j].setBackgroud(Color.black);
else
label[i][j].setBackgroud(Color.white);
add(label[i][j]);
}
}
}
}

错误截图如下:
Java常用组件与布局_第1张图片
各位大佬们,这段代码出现了三个错误,可是我一直都找不出来,跟例题的代码是一样的,检查了很多遍,一直运行不成功。

你可能感兴趣的:(java)