Skip to content

Commit

Permalink
Fix color chooser bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyers committed Jul 2, 2024
1 parent 314a9f6 commit a0ece7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions EU3_Scenario_Editor/src/editor/ColorChooserDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@
*/
public class ColorChooserDialog extends javax.swing.JDialog {

private DiscreteScalingMapMode mapMode;
private final DiscreteScalingMapMode mapMode;
private String colorsName;

private Color origLowColor;
private Color origMidColor;
private Color origHighColor;
private final Color origLowColor;
private final Color origMidColor;
private final Color origHighColor;

/** Creates new form ColorChooserDialog */
public ColorChooserDialog(EditorUI parent, DiscreteScalingMapMode mapMode) {
super(parent, true);
this.mapMode = mapMode;
this.colorsName = mapMode.getName();
if (colorsName == null)
colorsName = "default";
this.origLowColor = mapMode.getMinColor();
this.origMidColor = mapMode.getMidColor();
this.origHighColor = mapMode.getMaxColor();
Expand Down Expand Up @@ -217,7 +219,6 @@ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
mapMode.setMinColor(origLowColor);
mapMode.setMidColor(origMidColor);
mapMode.setMaxColor(origHighColor);
getParent().repaint();
this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed

Expand Down
1 change: 1 addition & 0 deletions EU3_Scenario_Editor/src/editor/EditorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ private void scaleColorsButtonActionPerformed(java.awt.event.ActionEvent evt) {/
if (mapPanel.getMode() instanceof DiscreteScalingMapMode) {
ColorChooserDialog dialog = new ColorChooserDialog(this, (DiscreteScalingMapMode) mapPanel.getMode());
dialog.setVisible(true);
mapPanel.refresh();
}
}//GEN-LAST:event_scaleColorsButtonActionPerformed

Expand Down

0 comments on commit a0ece7f

Please sign in to comment.