Moving and resizing JPanels object inside JFrame.

Posted by Gabriel A. Zorrilla on Stack Overflow See other posts from Stack Overflow or by Gabriel A. Zorrilla
Published on 2010-04-13T01:16:26Z Indexed on 2010/04/13 1:22 UTC
Read the original article Hit count: 272

Continuing my quest of learning Java by doing a simple game, i stumbled upon a little issue. My gameboard extends JPanel as well as each piece of the board. Now, this presents some problems:

  1. Cant set size of each piece, therefore, each piece JPanel ocupy the whole JFrame, concealing the rest of the pieces and the background (gameboard).
  2. Cant set the position of the pieces.

I have the default flow manager. Tried setbounds and no luck.

Perhaps i should make the piece to extend other JComponent?

© Stack Overflow or respective owner

Related posts about java

Related posts about game-development