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
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply 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.
 
 
subject: Issue with adding JPanel objects with layout managers
 
Threads others viewed
Drawing a simple clock in java
GridBagLayout
SpringLayout applied to a JPanel
JMenuBar not using default alignment?
OverStack?
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture