Results 1 to 6 of 6
  1. #1
    MarMer is offline Member
    Join Date
    May 2011
    Posts
    11
    Rep Power
    0

    Default How to Maximize the JFrame ?

    Hi...

    I want to maximize the new JFrame that is invoked in the first JFrame when the button is pressed. When the first JFrame is maximized, then the new JFrame will be maximized and close the first JFrame, if the first JFrame is not maximized then the new JFrame will not be maximized too.
    Is there the codes for this one?
    Thank you ...

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

  3. #3
    MarMer is offline Member
    Join Date
    May 2011
    Posts
    11
    Rep Power
    0

    Default

    I'm a beginner in this stuff...
    I don't know how to use the card Layout
    I already make 10 JFrame with different Layout ... =.="

    is there no way for this case ?

    Thank you ...

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

    Default

    To maximize a JFrame you would call its setExtendedState method and pass in Frame.MAXIMIZED_BOTH as the parameter. But again it seems kind of a strange design to have 10 JFrames in an application when most applications only need and should have one. Likely you'll want instead to swap JPanel views via a CardLayout, and if you're not familiar with using this, it's easy to look up the tutorial here: How to use CardLayout. Another option is to use JDialogs or JOptionPanes or a JTabbedPane. Again the tutorials will tell you more about these, and then you can decide which is the best for your situation.

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Frames are meant for doing frame-like stuff: providing the user with a way of sizing and closing a window, having a menu etc. Panels are meant for doing panel-like stuff: showing content nicely laid out.

    Even if you are a beginner and only familiar with screwdrivers the best way of getting a nail into a piece of timber is to learn about hammers.

    Oracle's Tutorial has a section on How to Use CardLayout that provides the codes and discusses them in detail.

    [Edit] Sorry for the repetition. Just slow; not trying to illustrate the hammer approach.
    Last edited by pbrockway2; 06-07-2011 at 02:17 AM.

  6. #6
    MarMer is offline Member
    Join Date
    May 2011
    Posts
    11
    Rep Power
    0

    Default

    Ok...

    Thank you all

    I will start study and read about using the card Layout
    Thank you very much :)

Similar Threads

  1. Disable Maximize button in JFrame?
    By Manish87 in forum AWT / Swing
    Replies: 0
    Last Post: 02-01-2011, 03:39 PM
  2. Replies: 6
    Last Post: 11-22-2010, 11:55 AM
  3. Want to Maximize your knowledge on Hibernate, Spring ?
    By fitce in forum Reviews / Advertising
    Replies: 2
    Last Post: 04-22-2010, 06:18 PM
  4. Minimize and maximize GUI
    By dejos456 in forum New To Java
    Replies: 6
    Last Post: 12-09-2009, 09:49 PM
  5. Replies: 2
    Last Post: 12-30-2008, 02:10 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
  •