I have created to GUI interfaces using netbeans drag n drop. The first interface has a button upon clicking which opens the second interface. I want to close the 1st interface as soon as I click the button in it so that only the second interface is displayed.
How can I do that?

James was faster...

BTW why you messing with drap and drop if you do not know basics? Your teacher will easily discover you used IDE to create application and you may loose marks because of it...

Edited 5 Years Ago by peter_budo: n/a

Thanks for the reply.. I was calling the class directly and hence the setVisible operation did not appear in the Action listener function. I made an object and den i was able to close it.

@peter: this was not for my assignment and didnt have any marks..

Just do something like that:

cmdEnter.addActionListener(new ActionListener() 
	{
       
    		public void actionPerformed(ActionEvent e)
    		{
    		    dispose();             //closes current Panel	
                    new frmPanel2().show();  //opens next Panel
    				
    		}	
    		
    });
This question has already been answered. Start a new discussion instead.