Results 1 to 2 of 2
  1. #1
    dhazwa is offline Member
    Join Date
    Jul 2011
    Posts
    15
    Rep Power
    0

    Default multiple jframes question

    Hi,

    I have a program that has a jframe with a button that opens up a second jframe. After the second frame is open, the user inputs some information and hits submit, at which time both jframes close.

    The issue im having is that upon opening the second frame, the user can still go back to the first and keep clicking the button opening multiple second frames, which I do not want.

    How can I set the first jframe so that when the second one is open, the user cannot get to the first jframe without exiting the second, or submitting and restarting the program?

    As always, any help is greatly appreciated!

    Thanks

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

    Default Re: multiple jframes question

    Instead of using a JFrame for your second frame, use a JDialog in modal mode (read the API documentation for that class). This prevents the user to do anything with the first frame as long as the dialog is visible.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Add a question with multiple choice answer
    By pink123 in forum AWT / Swing
    Replies: 6
    Last Post: 03-04-2011, 05:45 AM
  2. Multiple JFrames
    By frguy in forum Advanced Java
    Replies: 11
    Last Post: 01-08-2011, 10:36 AM
  3. Help: passing data from multiple JFrames
    By newicons in forum New To Java
    Replies: 5
    Last Post: 06-26-2010, 02:55 PM
  4. Question on Multiple Listeners implementation
    By StormyWaters in forum AWT / Swing
    Replies: 14
    Last Post: 06-11-2010, 08:28 PM
  5. Replies: 4
    Last Post: 11-13-2009, 12:30 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
  •