This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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.