This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.