Results 1 to 4 of 4
  1. #1
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    357
    Rep Power
    5

    Default Default Close Operation

    I have a login Screen that pops up first in my swing application. When the user puts in an incorrect login, they are prompted to try again, and if they do get it right, the login dialog is disposed of and the main application opens.

    How do I code for the program to completely exit if they click the "X" on the login dialog? right now if they close it, it closes the login, but opens the main application, defeating the purpose.

  2. #2
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    307
    Rep Power
    6

    Default

    You could try using a WindowListener and listen for WindowClosing events on the login screen.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,755
    Rep Power
    25

    Default

    Does the login dialog return a result code? Does that code say the user clicked the "x" button?

  4. #4
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    307
    Rep Power
    6

    Default

    Oops yeah didn't think my suggestion all the way through since it would catch all closing events. Probably should go with what Norm is leading to, a return value indicating whether or not the Login Screen was canceled or not.

Similar Threads

  1. Replies: 13
    Last Post: 04-09-2010, 12:15 PM
  2. XOR operation on bytes
    By divyanshu023 in forum New To Java
    Replies: 1
    Last Post: 09-17-2009, 08:11 PM
  3. Bit Wise operation: shifting
    By rueter in forum New To Java
    Replies: 1
    Last Post: 06-27-2009, 07:51 AM
  4. Replies: 1
    Last Post: 03-10-2009, 02:12 PM
  5. Frame close operation
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 09:39 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
  •