62,614
社区成员
发帖
与我相关
我的任务
分享
public class TestBorder extends JFrame{
public TestBorder()
{
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(9,9));
panel.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, Color.blue));
JLabel label[] = new JLabel[81];
for(int i=0;i<label.length;i++)
{
label[i]=new JLabel(""+i);
label[i].setBorder(BorderFactory.createLineBorder(Color.red));
panel.add(label[i]);
}
this.add(panel);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setBounds(new Rectangle(245,345));
//this.setResizable(false);
this.setLocationRelativeTo(null);
this.setVisible(true);
}
public static void main(String args[])
{
new TestBorder();
}
}