Results 1 to 6 of 6
Thread: Maximized window problem
- 01-09-2011, 08:46 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Maximized window problem
Hello again,
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...Java Code:this.setSize(redimensionarFrameTotal()); setLocationRelativeTo(null);
How do I solve this problem?
Thanks!
- 01-10-2011, 04:54 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
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.
- 01-10-2011, 03:02 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
- 01-10-2011, 07:42 PM #4
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
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.
- 01-10-2011, 08:03 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
GUI and JPanel in the same window... basic problem.
By xael in forum Java GamingReplies: 1Last Post: 11-18-2010, 08:17 PM -
jswing window problem
By mohitgupta1989 in forum New To JavaReplies: 3Last Post: 06-25-2010, 02:05 PM -
window.open problem
By praveenkumar14 in forum NetBeansReplies: 2Last Post: 10-12-2009, 11:18 AM -
Open a shell maximized (full screen)
By Java Tip in forum SWTReplies: 0Last Post: 07-25-2008, 02:27 PM -
All projects open maximized
By blk94snk in forum NetBeansReplies: 3Last Post: 07-28-2007, 08:12 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks