Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: System.exit(0)

  1. #1
    Member
    Join Date
    Apr 2011
    Location
    Niperia
    Posts
    30
    My Mood
    Amazed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default System.exit(0)

    Hi guys, am in another dilemma; i have an application that calls several classes/methods one of the method is a LoginInterface() that is called by the main Application Launcher based on an action command from a button. Now the methods and classes work fine, but i want to cancel the LoginInterface() dialog without cancelling or exiting the entire application. How do i do it? I have used the:

       System.exit(0);

    and...

    return;

    statements, but the entire application is closed on execution of the system.exit(0) statement; Is there a better way of closing only the LoginInterface() catalog without shutting down the whole application!?

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: System.exit(0)

    Try the dispose() method. Not sure why the whole program would be closing when a child dialog is exited (well, System.exit() would explain it), but if the dispose() doesn't work, post the button's actionListener and the LoginInterface class.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    aknessy (October 14th, 2013)

  4. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: System.exit(0)

    Is LoginInterface a JFrame (or extending from JFrame)? If so, you can set the default close operation?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  5. The Following User Says Thank You to aussiemcgr For This Useful Post:

    aknessy (October 14th, 2013)

  6. #4
    Member
    Join Date
    Apr 2011
    Location
    Niperia
    Posts
    30
    My Mood
    Amazed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: System.exit(0)

    i think the dispose() method worked just fine! Thanks a bunch, you've really cured my headache!

  7. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: System.exit(0)

    This is either a lesson to (1) ask a question on a programming forum and wait patiently for someone to answer, or (2) read the API of the class being used for a method or other solution and figure it out yourself. While in this case (1) worked, I suggest you become more independent and use (2) more often. That will build your confidence, knowledge, and skill as a programmer no matter what language you're using.

    Edit: Where are you? Argentina?

  8. The Following User Says Thank You to GregBrannon For This Useful Post:

    aknessy (October 14th, 2013)

  9. #6
    Member
    Join Date
    Apr 2011
    Location
    Niperia
    Posts
    30
    My Mood
    Amazed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: System.exit(0)

    Thanks man! lesson learned!

  10. #7
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: System.exit(0)

    You're welcome!

  11. #8
    Member
    Join Date
    Apr 2011
    Location
    Niperia
    Posts
    30
    My Mood
    Amazed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: System.exit(0)

    Sorry can i get the Java SE 6 API documentation in the Forums?

Similar Threads

  1. How to exit a login form
    By uijbaba in forum AWT / Java Swing
    Replies: 4
    Last Post: October 14th, 2013, 04:17 PM
  2. Help on exit button/panel
    By pilyo143 in forum AWT / Java Swing
    Replies: 5
    Last Post: February 13th, 2013, 07:07 AM
  3. [SOLVED] System exit command is not working properly
    By LRWalton in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 21st, 2012, 06:27 PM
  4. while loop wont exit
    By NewAtJava in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 29th, 2011, 11:42 AM
  5. Jar self delete on exit?
    By KiwiProg in forum Java Theory & Questions
    Replies: 1
    Last Post: December 19th, 2010, 02:54 AM