chess board in java

前端 未结 6 2087
夕颜
夕颜 2020-12-09 06:56

This is my code below

import javax.swing.*;
import java.awt.*;

public class board2 {

JFrame frame;
JPanel squares[][] = new JPanel[8][8];

public board2()          


        
6条回答
  •  无人及你
    2020-12-09 07:31

    Go here. This shows some of the different layouts you can use. One thing you may want to look into is the grid layout. This would make it easy for you to add JPanels for the squares. You could also use it to add labels around the board, but that is just one way of doing it. Go through the examples on the site, there is example code too.

提交回复
热议问题