my dog learned polymorphism*
The moose likes Game Development and the fly likes Issue with adding JPanel objects with layout managers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Issue with adding JPanel objects with layout managers" Watch "Issue with adding JPanel objects with layout managers" New topic
Author

Issue with adding JPanel objects with layout managers

kam natas
Greenhorn

Joined: Mar 06, 2010
Posts: 1
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with adding JPanel objects with layout managers
 
Similar Threads
SpringLayout applied to a JPanel
JMenuBar not using default alignment?
GridBagLayout
Drawing a simple clock in java
OverStack?