Hi. I'm in a middle of a situation I'm not sure how should I solve it. I'm using swing to build some forms (using JFrames in this case), and I use the lostFocus event on one JTextField to trigger some actions according to the text on that textfield. If the text entered on that text field is invalid I pop up a JDialog showing an error message. So far so good.
The only problem is if the user enters an invalid text into the JTextField and just after that presses the close button on the JFrame, the lostFocus event will trigger the JDialog to show, but since the original JFrame is closing my application will stall completly.
This behaviour happens all the time (I'm not sure it's a bug on jdk or if this is the way it should be...), so I suppose anyone might happened to face it before me, if so how should I solve it? I think the only thing I need is to avoid showing the JDialog if the JFrame is closing, but is there any way I can check JFrame's state?
Any help is appreciated
TIA
The only problem is if the user enters an invalid text into the JTextField and just after that presses the close button on the JFrame, the lostFocus event will trigger the JDialog to show, but since the original JFrame is closing my application will stall completly.
This behaviour happens all the time (I'm not sure it's a bug on jdk or if this is the way it should be...), so I suppose anyone might happened to face it before me, if so how should I solve it? I think the only thing I need is to avoid showing the JDialog if the JFrame is closing, but is there any way I can check JFrame's state?
Any help is appreciated
TIA