Results 1 to 3 of 3
  1. #1
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

    Default Handling Two JFrames

    Hi,

    I have a JFrame with a button on it. I want a second Jframe to appear when the user clicks on the button. Also the first Jframe should be inactive while the second Jframe is displayed and it should be re-enabled when the user closes the second Jframe. Second Jframe should be always displayed on top of the first Jframe.

    I know how to do this in C#. Can anybody tell me the Java way of doing this? I would appreciate some example code segments as well.

    Regards,
    Hiranya

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    Check JDialog class. It can be used as the second frame you described when you specify its parent as the first JFrame.

  3. #3
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

    Default Thanks

    Thanks for the tip. It directed me in the right direction. So for all folks out there here's how to do this.

    The second form should extend the JDialog class.
    Then call the setModalityType() method on the second form with the Application_Modality parameter.

    Regards,
    Hiranya

Similar Threads

  1. problem with getting new JFrames
    By geork in forum New To Java
    Replies: 0
    Last Post: 02-09-2008, 12:46 PM
  2. SWT Event Handling
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-30-2007, 12:21 PM
  3. Event Handling
    By luisarca in forum Sun Java Wireless Toolkit
    Replies: 5
    Last Post: 05-07-2007, 06:05 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
  •