Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- public class Board {
- JPanel board;
- JPanel x1;
- JButton[] button = new JButton[65];
- Board(){
- board = new JPanel();
- BorderLayout bl = new BorderLayout();
- board.setLayout(bl);
- x1 = new JPanel();
- GridLayout gl = new GridLayout(8,8);
- x1.setLayout(gl);
- for (int i=1; i<button.length; i++) {
- button[i] = new JButton("...");
- button[i].setPreferredSize(new Dimension(60, 60));
- x1.add(button[i]);
- }
- board.add("Center", x1);
- JFrame frame = new JFrame("Chess");
- frame.setContentPane(board);
- frame.pack();
- frame.setVisible(true);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public static void main(String[] args) {
- Board b = new Board();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement