'How can I disable a button from an option dialog?
I have an option dialog like the example below and I want to disable one of it's buttons.
String[] buttons = ["Search", "Show Report", "Exit"]
int message_result = JOptionPane.showOptionDialog(null, "Blah blah blah", "Message", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE , null, buttons, buttons[0])
switch (message_result) {
case 0:
// "Search" button code here...
break
case 1:
// "Show Report" button code here...
break
case 2:
System.exit(0)
break
default:
System.exit(0)
break
}
Let's say I want button "Show Report" to be disabled if something is true. How can I do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
