H
HS1
Hello all
I want to show a dialog asking users to select a string. They also can
Cancel if they want to cancel the input.
Here is the code for a JOptionPane:
Object[] possibleValues {"First", "Second", "Third"};
Object selectValue = JOptionPane.showInputDialog(null, "Choose one", "Input
value", JOptionPane.OK_CANCEL_OPTION, null, possibleValues,
possibleValues[0]);
if (selectValue != null){
" ...Do Something..."
}
It can be seen that the dialog has two button: OK and Cancel. However the
cancel button does not work as when I click Cancel, my application still
"...Do Something..."
Could you please help to fix this
Many thanks
SH1
I want to show a dialog asking users to select a string. They also can
Cancel if they want to cancel the input.
Here is the code for a JOptionPane:
Object[] possibleValues {"First", "Second", "Third"};
Object selectValue = JOptionPane.showInputDialog(null, "Choose one", "Input
value", JOptionPane.OK_CANCEL_OPTION, null, possibleValues,
possibleValues[0]);
if (selectValue != null){
" ...Do Something..."
}
It can be seen that the dialog has two button: OK and Cancel. However the
cancel button does not work as when I click Cancel, my application still
"...Do Something..."
Could you please help to fix this
Many thanks
SH1