Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NetBeans IDE 5.5

 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.
how can i close 1st jframe with a click of mouse?and open next jframe?
 
Hanuma Deepak Muvvala
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which JFrame?
 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i open 2nd frame in the same project by a click of a button in 1st frame? and close 1st frame?
pleas help
thank you
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just take a reference of second jframe and make its setVisible property true inside event handler and also make setVisible property of first jframe to false immediatly after.

cheers
 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks nidhi,
i did that but i can open 2nd frame but 1st frame will be there at back.
any other solutions?
thank you
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

vijalaxmi wrote:
i did that but i can open 2nd frame but 1st frame will be there at back.
any other solutions?



prefer it,
JFrame yourframe=new JFrame();
yourframe.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);

yourframe.setVisible(false);
}

});


hope this will help you

cheers
 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you john
the last line is giving error that is yourframe.setVisible(false);
if i remove this line and run the frame its not closing the 1st frame.
thank you.
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in little difficulty to understand, what exactly you are doing.
can you phrase your code here?
 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFrame mainpage = new JFrame();
mainpage.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
mainpage.setVisible(false);

mainpage.setVisible(false); is error.

rest of the code is no problem.
if i run without the last line of code frame is opening but will not close the 1st frame.
thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic