Maximized window problem
well... i am having a problem... I want my aplicattion to be all ways "maximized" when executed, and i used the following:
but my components in the netbeans project are lined up, and organzied, but when i run the project, the frame gets maximized as i wanted, but the components doesn´t stay the same way... They get shorter then before, or they just change position...
How do I solve this problem?
You'll need to use a different LayoutManager if you are not liking the result of the one you are using. Personally, I like to mostly Boxes for layout, or write my own layout manager. I've never been satisfied with the ones swing gives you out of the box.
can you help me out with that??
Originally Posted by toadaly
Take a look at the Box class in swing. It allows you to layout component horizontally or vertically, and includes a subclass for adding spacers. You can nest Box'es inside other boxes, and so by doing this, you can get any kind of layout you want, and they tend to scale well.
Another option to look at is the SpringLayout, which works kind of like Boxes, but allows more constraints.
++ for everything toadaly has written above.
Also, consider nesting containers (often JPanels) each using one of the simple layouts such as BorderLayout and GridLayout. I generally avoid GridBagLayout but use it if I have to. I've heard good things about MigLayout, but it is not part of standard Java and needs to be downloaded from its site.
Use the Frame.setExtendedState( ... ) method (a JFrame is a subclass of a Frame).
Originally Posted by lostmind