Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with adding JPanel objects with layout managers

 
kam natas
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. The games I made in the past did not contain any customized menus (ie. not from JOptionPane) different components dividing the display screen... so I thought I would try to on my current game I'm working on. So here's the issue: I'm trying to set the GUI up for the game screen.. but when I try to add in additional JPanel objects into the my main JFrame object, all of the JPanel objects stack up at the very top left corner (their not supposed to because I am using a layout manager). Here's my simplified version of the code:



Notes:
-The sum of miniMapPanel.width, statsPanel.width, ... , commandPanel.width add up to 1280 pixels.
- miniMapPanel.height, statsPanel.height, ... , commandPanel.height all have the same height of 256 pixels.
- What I'm trying to do is set up a GUI very similar to that of StarCraft, and WarCraft.
- The game is set up in full screen.

When I compile the program, I see (and I've tested for it) that all of the JPanel objects that were created are all stacked one on top of each other, in the top left corner of the screen. Any ideas and/or suggestions are welcome.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic