wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes intercepting return from JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "intercepting return from JOptionPane" Watch "intercepting return from JOptionPane" New topic
Author

intercepting return from JOptionPane

Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Hi all!
I'm using a JList in a JOptionPane to get some input from the user. When I call JOptionPane.showOptionDialog(), it will return an int indicating the result (i.e., whether the user clicked OK or CANCEL, etc.).
My question is, I would like to be able to check the user input BEFORE the JOptionPane disappears. For example, if the user clicked the OK button but did NOT select an item from the JList, I would like to use a beep to alert them and keep the JOptionPane up until the user either selects a value or clicks CANCEL.
Does anyone know a way to achieve this?
Thanks!
Stephanie
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Sounds like a situation that requires a custom dialog. JOptionPane is great for generic functionality in message boxes, but if you have to do any custom handling, you will probably have to create a custom dialog box to do it.
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Thanks, Bodie!
I'll look into that.
Stephanie
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: intercepting return from JOptionPane
 
Similar Threads
how to manage the dissmissal of joptionpane when any button is clicked
JOptionPane
JOptionPane
JOptionPane or JFrame?
How to bring user back to the internalframe after JOptionPane?