closing JFrame with button click

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Norgy
    New Member
    • May 2013
    • 56

    closing JFrame with button click

    Code:
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
    
            next2 nx = new next2();
            next me = new next();
            me.setVisible(false);
            nx.setVisible(true);
            
        }
    i am trying to close the "next" frame with the line me.setVisible(f alse); and display another one with the line nx.setVisible(t rue);
    but when i run the code and press jButton1, the "next" frame doesn't disappear
  • Norgy
    New Member
    • May 2013
    • 56

    #2
    i have tried : this.dispose; and it worked

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Glad you were able to solve the problem. Also, thanks for posting the solution. :-)

      Comment

      Working...