Results 1 to 2 of 2

Thread: JButton close?

  1. #1
    jean28 is offline Member
    Join Date
    Aug 2012
    Rep Power

    Default JButton close?

    Does anyone know how I can make it so that when I press any of the JButtons in a window the window closes?

    Thanks a lot.

  2. #2
    pakupakuman is offline Member
    Join Date
    Sep 2012
    Rep Power

    Default Re: JButton close?

    If *any* of the buttons, then put a condition (an if) in your ActionListeners to perform a System.exit(0).

    If a dedicated button, then no condition is necessary (but the ActionListener is).

Similar Threads

  1. How to Close ChildPanel only ??
    By captainpirate in forum AWT / Swing
    Replies: 4
    Last Post: 01-14-2012, 02:08 AM
  2. ActionListener for JButton after changing Button to JButton
    By ravi.joshi53 in forum Java Applets
    Replies: 2
    Last Post: 10-07-2011, 07:35 AM
  3. Replies: 10
    Last Post: 09-17-2011, 11:59 AM
  4. Replies: 13
    Last Post: 04-09-2010, 11:15 AM
  5. close to zero
    By nokicky in forum New To Java
    Replies: 6
    Last Post: 10-26-2009, 04:30 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