194.206.56.241 writes:
I try to make a modal window box (something like "COntinue ?" + YES button + NO button) but : JDialog : can be set to modal but has a "X" closing button that I was unable to remove. JFrame or JInternalFrame : can be set to be not closable but I was unable to set it modal.
Any idea ?
NJXT
24.1.16.214 writes:
here's a really _lame_ idea...
what if upon receiving a 'windowClosed' event, you just open up that same modal dialog again?
"close it all you want, we'll make more"
-calyxa
194.206.56.241 writes:
And how do I REALLY close it when work is done ?
NJXT
171.211.118.118 writes:
What's the problem? If you don't want the close feature, then don't write one in. I haven't really used Swing, but it seems that the close button shouldn't be a problem. If calyxa's suggestion would work, then writing a blank windowClosing() event should work even better. Then you could .hide(), and .dispose() of the window whenever some conditions are met, i.e. a file is selected and the "Open" button is clicked.
MikeD
152.206.123.160 writes:
Hmmm .... my last post seemed rather "gruff." :-) It rubbed me the wrong way, and I'm the one who wrote it. Apologies to the original poster, if any offense was taken; none was intended. Just ignore me sometimes people ...
MikeD
194.206.56.241 writes:
No problem :) I try to override the WindowClosing (with an empty one) but when clicking on the "X" button, it still closes the window.
NJXT
205.188.193.174 writes:
Somehow a functional WindowListener has been attached to your Window. It might even be that your Java developing enviornment tacks one on automatically for you. But Windows do not close by themselves in Java; that functionality has to be specifically coded-in. Check your other listeners: mouse, key, button, etc. for a WindowClosing() method.
MikeD
152.202.119.246 writes:
FileDialogs have a close event written in. Sorry. But they don't work very well, in any case. Peace.
MikeD
194.206.56.241 writes:
Ok, thank you for all that stuff :) I'll try.
NJXT
24.1.16.214 writes:
like MikeD says, .dispose() it yourself upon getting the event from the OK button.
-calyxa