- int reply = JOptionPane
- .showInternalOptionDialog(
- ap,
- bigpanel,
- MessageManager
- .getString("label.adjunst_foreground_text_colour_thereshold"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE, null, null, null);
+ Object[] options = new Object[] { MessageManager.getString("action.ok"),
+ MessageManager.getString("action.cancel") };
+ String title = MessageManager
+ .getString("label.adjust_foreground_text_colour_threshold");
+ Runnable action = () -> // response for 1 = Cancel
+ {
+ restoreInitialSettings();
+ };
+ JvOptionPane.newOptionDialog(alignPanel.alignFrame)
+ .setResponseHandler(1, action).showInternalDialog(bigpanel,
+ title, JvOptionPane.YES_NO_CANCEL_OPTION,
+ JvOptionPane.PLAIN_MESSAGE, null, options,
+ MessageManager.getString("action.ok"));
+ }
+
+ /**
+ * Restore initial settings on Cancel
+ */
+ protected void restoreInitialSettings()
+ {
+ if (sg == null)
+ {
+ ap.av.setTextColour(original1);
+ ap.av.setTextColour2(original2);
+ ap.av.setThresholdTextColour(originalThreshold);
+ }
+ else
+ {
+ sg.textColour = original1;
+ sg.textColour2 = original2;
+ sg.thresholdTextColour = originalThreshold;
+ }