Link to home
Start Free TrialLog in
Avatar of Kennywen
Kennywen

asked on

Disable auto close of JOptionPane

sample code as below:

String[] options = {"OK","CANCEL"};
            int input = JOptionPane.showOptionDialog(
                null,   // parentComponent
                newRecordPanel, // message
                "New", // title
                JOptionPane.OK_CANCEL_OPTION,   // optionType
                JOptionPane.PLAIN_MESSAGE,    // messageType
                null,   // icon
                options,    // options
                options[0]  // initialValue
            );

i will do some validation when user click on OK button, if the validation is fail then the JOptionPane show remain there (do not close it). But how can i disable the auto close of the JOptionPane?

thanks
Avatar of Mick Barry
Mick Barry
Flag of Australia image

easiest would be to redisplay pane when validationn fails
ASKER CERTIFIED SOLUTION
Avatar of gnoon
gnoon
Flag of Thailand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just an example of objects's comment.