Results 1 to 5 of 5
  1. #1
    shaay is offline Member
    Join Date
    Jul 2010
    Posts
    7
    Rep Power
    0

    Default override the close button

    hi.....

    i wanted to know how to override the close button by adding a joptionpane confirm message in to the close button

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Are we dealing with a Swing app here? Should this question be moved to the Swing forum?

    edit: I"m going to assume so and will move this question.

  3. #3
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    Quote Originally Posted by shaay View Post
    hi.....

    i wanted to know how to override the close button by adding a joptionpane confirm message in to the close button
    I guess the code may solve this thread

    Java Code:
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    and for optionpane you have to listen window closing events :) windowClosing method is to help you

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,882
    Rep Power
    25

    Default

    Add a window listener and add your code to the appropriate method(s) in the interface.

  5. #5
    shaay is offline Member
    Join Date
    Jul 2010
    Posts
    7
    Rep Power
    0

Similar Threads

  1. remove close button
    By silversurfer2in in forum AWT / Swing
    Replies: 9
    Last Post: 07-02-2013, 09:05 PM
  2. Replies: 0
    Last Post: 04-28-2010, 02:39 PM
  3. Replies: 13
    Last Post: 04-09-2010, 12:15 PM
  4. How do I close a frame with a button?
    By Psyclone in forum AWT / Swing
    Replies: 7
    Last Post: 02-19-2010, 11:43 PM
  5. how disable the display of close button on the frame
    By kalanidhi in forum New To Java
    Replies: 6
    Last Post: 11-19-2008, 10:51 AM

Posting Permissions

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