I can add pieces to it with
panel = (JPanel)board.getComponent(9);
Piece = new JLabel(new ImageIcon("king.png"));
panel.add(Piece);
I could not figure out how to move one JLabel (Piece) from one panel to another panel. Instead someone gave me the idea of adding a new piece to another tile and removing the piece from the old tile.
I can't figure out how to remove a piece from the panel I want.
panel.remove(Piece);
will remove the piece from the last tile I added to, but I need to be able to select which tile I want to remove from.
panel = (JPanel)board.getComponent(9);
does not work.
Do I need to select the panel, or move the focus to that panel or what?

New Topic/Question
This topic is locked



MultiQuote







|