Results 1 to 2 of 2
  1. #1
    vahshir is offline Member
    Join Date
    Aug 2010
    Rep Power

    Default Dispose Jframe from another class.

    Hey guys. Just wondering if you can dispose a JFrame from another class. for example I have a button that creates a new JFrame that is in a different class and I want to dispose of the old one? Any pointers would be great.

    Cheers Vahshir

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    What happened when you tried it?

    There's no magic about the dispose() method. You can call it in a similar way that you would call any other instance method.

    That said, it's usually bad design for an application to have more than one JFrame. The more common idiom is to have one JFrame and use modal JDialogs (or JOptionPane methods that show a modal dialog).


Similar Threads

  1. Class that extends JFrame help
    By javaman1 in forum New To Java
    Replies: 5
    Last Post: 11-10-2010, 02:29 AM
  2. Adding a menu from a seperate class to a JFrame
    By minime12358 in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2010, 05:50 PM
  3. JFrame Hanging When Called From Another Class
    By al_Marshy_1981 in forum AWT / Swing
    Replies: 5
    Last Post: 03-30-2010, 07:04 PM
  4. Replies: 8
    Last Post: 03-21-2009, 09:34 AM
  5. i cant dispose the jframe(urgent)
    By arunkumarinfo in forum NetBeans
    Replies: 2
    Last Post: 02-24-2009, 09:19 AM

Posting Permissions

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