• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NetBeans IDE 5.5

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi.
how can i close 1st jframe with a click of mouse?and open next jframe?
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which JFrame?
 
vijayalaxmi amu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic