Ofcourse, shall i post the chessboardview class this is the class that contains the gridlayout(8,8) and contains the JLabels
package view;
import java.awt.*;
import java.util.ArrayList;
Type: Posts; User: gokuball
Ofcourse, shall i post the chessboardview class this is the class that contains the gridlayout(8,8) and contains the JLabels
package view;
import java.awt.*;
import java.util.ArrayList;
2240
any idea how i can get rid of the white space between the jlabels
private void setSquareColors(){
for(Square square: squares){
if(square.toString().matches("A1|C1|E1|G1|B2|D2|F2|"
+ "H2|A3|C3|E3|G3|B4|D4|F4|H4|A5|C5|E5|G5|"
+...
previous page shows the code of the classes
and how do i do that? the gridlayout doesn't know which row or collum i am in right?
thanks for you help!
--- Update ---
I go to test all...
I fixed it! the squares are in the right position. But how do i set the color right for each square. A1 = brown for instance B1 = white C1 = brown etc
which method are you talking about?
--- Update ---
can you please post the code you made to get to the point of the grid with all the labels and icons in it
can you post the code?
how did you get that? which code?
private void createGUI() {
Dimension boardSize = new Dimension(200, 200);
setLayout( new GridLayout(8, 8) );
setPreferredSize( boardSize );...
private void addImageToSquare() {
for(int i = 0; i < 64; i++){
if (chessboard.getSquare(i).getColor().equals("WHITE")){
chessboard.getSquare(i).setImage(LIGHT_BROWN);
}...
I dont know which JLabels
public class ChessBoard {
private Set<ChessPiece> chessPieces;
private ArrayList<Square> squares;
private static final String[] LOCATIONS = {
...
what do you mean by what order? thanks for you help!
public class ChessBoardView extends JPanel
{
//intialize variables
private final static ImageIcon DARK_BROWN = new ImageIcon ...
i dont know how to change a gridlayout so it contains 64 jlabels in the right order
how do i change a grid logic so the labels are set correctly?
the location value and the color and image are set correctly the arraylist contains 64 squares with string location, string color, ImageIcon image. Now in the chessboardview which extends...
i need something like
for (int i = 0; i < 64; i++) {
int row = (i / 8) % 2;
if (row == 0)
Okay i made my square class JLabel what next? I have 64 different square objects, each with different locations.
import javax.swing.JLabel;
public class Square extends JLabel{
but what...
can you code an example for me?
--- Update ---
i all ready have that right?
Guys,
I am developing a chess manager program(not an interactive game)!
I have the following classes in my model package
ChessPieces
ChessBoard contains Squares in an ArrayList and...