Results 1 to 2 of 2
  1. #1
    phearless is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default Cancel button for exiting app

    Hi! I created JButton "Cancel" and i want to use it for exiting my application, like when I push the "x" button at the right top of application window. Now, I think that I need to do ActionListener but I don't know what to write in it, or should I do something else? thx

  2. #2
    phearless is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default

    ok, i've done it :). I just added System.exit(0); in ActionListener of button Cancel. So simply but it works. I tried some tips from other forums and posts, they had at least 5-10 lines of code and it didn't work for me.

Similar Threads

  1. Exiting a while loop using a String?
    By Isshin in forum New To Java
    Replies: 4
    Last Post: 02-22-2010, 12:33 AM
  2. exiting a while loop with a string
    By Aldius in forum New To Java
    Replies: 3
    Last Post: 12-10-2009, 11:38 PM
  3. Exiting on menuSelected action
    By benra in forum New To Java
    Replies: 8
    Last Post: 10-13-2009, 05:58 PM
  4. Struts 2 cancel button
    By kirtichopra2003 in forum Advanced Java
    Replies: 0
    Last Post: 09-29-2009, 04:40 PM
  5. How should I cancel this thread ?
    By playwin2 in forum Threads and Synchronization
    Replies: 7
    Last Post: 08-27-2008, 07:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •