Search:

Type: Posts; User: gokuball

Search: Search took 0.14 seconds.

  1. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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;
  2. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    2240

    any idea how i can get rid of the white space between the jlabels
  3. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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|"
    +...
  4. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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...
  5. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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
  6. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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
  7. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    can you post the code?
  8. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    how did you get that? which code?



    private void createGUI() {
    Dimension boardSize = new Dimension(200, 200);

    setLayout( new GridLayout(8, 8) );
    setPreferredSize( boardSize );...
  9. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    private void addImageToSquare() {

    for(int i = 0; i < 64; i++){
    if (chessboard.getSquare(i).getColor().equals("WHITE")){
    chessboard.getSquare(i).setImage(LIGHT_BROWN);
    }...
  10. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    I dont know which JLabels


    public class ChessBoard {

    private Set<ChessPiece> chessPieces;
    private ArrayList<Square> squares;
    private static final String[] LOCATIONS = {
    ...
  11. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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 ...
  12. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    i dont know how to change a gridlayout so it contains 64 jlabels in the right order
  13. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    how do i change a grid logic so the labels are set correctly?
  14. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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...
  15. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    i need something like


    for (int i = 0; i < 64; i++) {


    int row = (i / 8) % 2;
    if (row == 0)
  16. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    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...
  17. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Re: Chess Program

    can you code an example for me?

    --- Update ---



    i all ready have that right?
  18. Thread: Chess Program

    by gokuball
    Replies
    218
    Views
    15,155

    Chess Program

    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...
Results 1 to 18 of 18