Results 1 to 9 of 9

Thread: Java Question

  1. #1
    Pinky4Free is offline Member
    Join Date
    Nov 2012
    Posts
    15
    Rep Power
    0

    Default Java Question

    How can i make my java program send a MySQL Update query when i click on the exit button? i tried to use WindowClosing or whatever, but it takes like 5 seconds to close the program and it still never sends the mysql query.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,005
    Rep Power
    23

    Default Re: Java Question

    Please go through the Forum Rules, particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Pinky4Free is offline Member
    Join Date
    Nov 2012
    Posts
    15
    Rep Power
    0

    Default Re: Java Question

    Sorry.

  4. #4
    Pinky4Free is offline Member
    Join Date
    Nov 2012
    Posts
    15
    Rep Power
    0

    Default Re: Java Question

    Am i able to edit the title?

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    9

    Default Re: How can i make java execute a function as i close the window?

    Quote Originally Posted by Pinky4Free View Post
    How can i make my java program send a MySQL Update query when i click on the exit button? i tried to use WindowClosing or whatever, but it takes like 5 seconds to close the program and it still never sends the mysql query.
    Do you mean close a window, or exit the application? For the former, add a WindowListener. For the latter, you could add a Shutdown hook (See the API for Runtime)

  6. #6
    Pinky4Free is offline Member
    Join Date
    Nov 2012
    Posts
    15
    Rep Power
    0

    Default Re: How can i make java execute a function as i close the window?

    Quote Originally Posted by doWhile View Post
    Do you mean close a window, or exit the application? For the former, add a WindowListener. For the latter, you could add a Shutdown hook (See the API for Runtime)
    Could you post some example code on how i would do so?

  7. #7
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    9

    Default Re: How can i make java execute a function as i close the window?

    Quote Originally Posted by Pinky4Free View Post
    Could you post some example code on how i would do so?
    What did your research tell you? Did you search the forums, or the internet? There are possibly hundreds (more like thousands) of code examples and/or tutorials online. Adapting the code to your project requires some understand of what its doing, and if you don't or have problems doing so consult the API, and/or post an SSCCE with a specific question

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,005
    Rep Power
    23

    Default Re: Java Question

    Edit the post and click 'Go Advanced'

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,373
    Blog Entries
    7
    Rep Power
    25

    Default Re: Java Question

    @OP: I merged your two threads; please don't double post.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Java question.
    By immortal in forum New To Java
    Replies: 8
    Last Post: 08-07-2012, 03:49 AM
  2. java question
    By jm47 in forum New To Java
    Replies: 2
    Last Post: 04-12-2012, 04:23 AM
  3. Java question?
    By Zeronitic in forum New To Java
    Replies: 1
    Last Post: 02-21-2012, 09:35 PM
  4. Java Question [Beginner Question]
    By joker760 in forum New To Java
    Replies: 3
    Last Post: 12-13-2011, 05:01 PM
  5. Replies: 33
    Last Post: 01-21-2011, 04:07 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
  •