Advertisement
votako

oard

Mar 4th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import javax.swing.*;
  2. import java.awt.*;
  3.  
  4. public class Board {
  5.     JPanel board;
  6.     JPanel x1;
  7.     JButton[] button = new JButton[65];
  8.     Board(){
  9.         board = new JPanel();
  10.         BorderLayout bl = new BorderLayout();
  11.         board.setLayout(bl);
  12.  
  13.  
  14.         x1 = new JPanel();
  15.         GridLayout gl = new GridLayout(8,8);
  16.         x1.setLayout(gl);
  17.  
  18.  
  19.         for (int i=1; i<button.length; i++) {
  20.             button[i] = new JButton("...");
  21.             button[i].setPreferredSize(new Dimension(60, 60));
  22.             x1.add(button[i]);
  23.         }
  24.  
  25.         board.add("Center", x1);
  26.  
  27.         JFrame frame = new JFrame("Chess");
  28.         frame.setContentPane(board);
  29.         frame.pack();
  30.         frame.setVisible(true);
  31.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  32.          
  33.     }
  34.     public static void main(String[] args) {
  35.         Board b = new Board();
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement