java - Building a Monopoly Board with GridBagLayout -
I am creating a Java version of monopoly in my spare time and trying to understand some problems for swing I am
Each of my places on the board is essentially a custom pocket
and I am trying to keep them around the edge of a frame (like on monopoly board) . I can not find any useful explanation of how the layout system works and there is a problem in doing so.
Can anyone give me an example of the point of which side frame of the frame? Should I Use A Different Layout?
It seems to lend itself to work best with one. I recommend creating 4 JPanel
S, which will include all the JButton
s.
Then add JPanels
to border layout. North
, south
, east
, and west
.
I think it might be the easiest way to layout buttons.
There is a great place to start using a border layout
.
I just threw some code which may help you start laying it out It has not been compiled.
int boardWidth; Int board light; Int BoardSquareHite; Int boardSqusreWidth; JPN answer = new zpn (); Zpinal south = new zpn (); Dimension northside = new dimension (boardwidth, boardscream); North.setPreferedSize (northSouthD); South.setPreferedSize (northSouthD); JPNext = new zpn (); Jepnell west = new zpn (); Dimension prefix = new dimension (boardscream, board height - 2 * boardswireweb); East.setPreferedSize (easWestD); West.setPreferedSize (easWestD); // Add all buttons to the appropriate JPanel parentPanel.setLayoutManager (new border layout ()); ParentPanel.add (North, Border layer North); ...
Comments
Post a Comment