Results 1 to 6 of 6
  1. #1
    lostmind is offline Member
    Join Date
    Dec 2010
    Posts
    17
    Rep Power
    0

    Default 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:


    Java Code:
           this.setSize(redimensionarFrameTotal());
            setLocationRelativeTo(null);
    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?

    Thanks!

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    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.

  3. #3
    lostmind is offline Member
    Join Date
    Dec 2010
    Posts
    17
    Rep Power
    0

    Default

    Quote Originally Posted by toadaly View Post
    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??

  4. #4
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    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.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    ++ 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.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,352
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by lostmind View Post
    Hello again,

    well... i am having a problem... I want my aplicattion to be all ways "maximized" when executed
    Use the Frame.setExtendedState( ... ) method (a JFrame is a subclass of a Frame).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 1
    Last Post: 11-18-2010, 08:17 PM
  2. jswing window problem
    By mohitgupta1989 in forum New To Java
    Replies: 3
    Last Post: 06-25-2010, 02:05 PM
  3. window.open problem
    By praveenkumar14 in forum NetBeans
    Replies: 2
    Last Post: 10-12-2009, 11:18 AM
  4. Open a shell maximized (full screen)
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-25-2008, 02:27 PM
  5. All projects open maximized
    By blk94snk in forum NetBeans
    Replies: 3
    Last Post: 07-28-2007, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •