Switch from property change to action.
(PropertyChangeEvent evt)
| 229 | * |
| 230 | */ |
| 231 | @Override |
| 232 | public void propertyChange(PropertyChangeEvent evt) { |
| 233 | value = evt.getNewValue(); |
| 234 | switch (evt.getPropertyName()) { |
| 235 | case "inputValue": |
| 236 | process(value); |
| 237 | break; |
| 238 | case "value": |
| 239 | if (value != null && options == null && !(value instanceof Integer)) { |
| 240 | process(getOptionIndex(((JOptionPane) evt.getSource()).getOptions(), value)); |
| 241 | return; |
| 242 | } |
| 243 | if (options != null) { |
| 244 | int i = getOptionIndex(options, value); |
| 245 | value = Integer.valueOf(i >= 0 ? i : JOptionPane.CLOSED_OPTION); |
| 246 | } |
| 247 | process(value); |
| 248 | break; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | private int getOptionIndex(Object[] options, Object val) { |
| 253 | if (options != null) |
nothing calls this directly
no test coverage detected