Computer Science Canada Issue with adding JPanel objects with layout managers |
Author: | Kam [ Sat Mar 06, 2010 5:17 am ] | ||
Post subject: | Issue with adding JPanel objects with layout managers | ||
Hey I've posted this on a few other forums but haven't gotten much replies.. so I'll try here. Anyways... 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. |
Author: | facultyofmusic [ Fri Mar 12, 2010 5:50 pm ] |
Post subject: | Re: Issue with adding JPanel objects with layout managers |
consider using the null layout? It's a lot better than using other complicated ones unless you need the elements to be dynamically resizable... |