• 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

How do I exit?

 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, here's the scenario (coming along pretty well):

I have an application AutoHistory that calls an AddVehicle application as follows:



This works well, and the AddVehicle does it's task of presenting a panel from which vehicle information is collected; then, when a "Save" button is pressed, it adds the information to a file. Now, at the bottom of the AddVehicle panel is a "Return" button; when this button is pressed I would like it to close the AddVehicle application and return to the AutoHistory application.

AddVehicle is defined as:


AutoHistory is defined as:
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
frame.setVisible( false ); ,or
frame.dispose();
 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Camick wrote:frame.setVisible( false ); ,or
frame.dispose();



Thanks! Both seem to work, what is the difference?
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
setVisible(false) merely hides the window, whereas dispose() really cleans up the Window. After calling setVisible(false), a call to setVisible(true) will simply show the window again. After dispose() the window has to be completely rebuilt from system resources.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the setDefaultCloseOperation method?
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike Lipay wrote:
Thanks! Both seem to work, what is the difference?



Did you read the API? Its explained there.

If there is something you don't understand, then quoted the text from the API description.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic