Issue with adding JPanel objects with layout managers
posted 6 years ago
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:
-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.