diff --git a/MekHQ/resources/mekhq/resources/MekHqOptionsDialog.properties b/MekHQ/resources/mekhq/resources/MekHqOptionsDialog.properties
index ec80cc3d92..d2e90b8596 100644
--- a/MekHQ/resources/mekhq/resources/MekHqOptionsDialog.properties
+++ b/MekHQ/resources/mekhq/resources/MekHqOptionsDialog.properties
@@ -23,6 +23,39 @@ optionPersonnelFilterStyle.text=Personnel Filter Style
optionPersonnelFilterStyle.toolTipText=This is the style for which Personnel Filters will be displayed
optionPersonnelFilterOnPrimaryRole.text=Filter Personnel Based On Primary Role
+#Display Colour Tab
+displayColourTab.title=Display Colour Options
+optionDeployedForeground.text=Deployed Foreground
+optionDeployedBackground.text=Deployed Background
+optionBelowContractMinimumForeground.text=Below Contract Minimum Foreground
+optionBelowContractMinimumBackground.text=Below Contract Minimum Background
+optionInTransitForeground.text=In-Transit Foreground
+optionInTransitBackground.text=In-Transit Background
+optionRefittingForeground.text=Refitting Foreground
+optionRefittingBackground.text=Refitting Background
+optionMothballingForeground.text=Mothballing Foreground
+optionMothballingBackground.text=Mothballing Background
+optionMothballedForeground.text=Mothballed Foreground
+optionMothballedBackground.text=Mothballed Background
+optionNotRepairableForeground.text=Not Repairable Foreground
+optionNotRepairableBackground.text=Not Repairable Background
+optionNonFunctionalForeground.text=Non-Functional Foreground
+optionNonFunctionalBackground.text=Non-Functional Background
+optionNeedsPartsFixedForeground.text=Needs Parts Fixed Foreground
+optionNeedsPartsFixedBackground.text=Needs Parts Fixed Background
+optionUnmaintainedForeground.text=Unmaintained Foreground
+optionUnmaintainedBackground.text=Unmaintained Background
+optionUncrewedForeground.text=Uncrewed Foreground
+optionUncrewedBackground.text=Uncrewed Background
+optionLoanOverdueForeground.text=Loan Overdue Foreground
+optionLoanOverdueBackground.text=Loan Overdue Background
+optionInjuredForeground.text=Injured Foreground
+optionInjuredBackground.text=Injured Background
+optionHealedInjuriesForeground.text=Healed Injuries Foreground
+optionHealedInjuriesBackground.text=Healed Injuries Background
+optionPaidRetirementForeground.text=Paid Retirement Foreground
+optionPaidRetirementBackground.text=Paid Retirement Background
+
#Autosave Tab
autosaveTab.title=Autosave options
optionNoSave.text=Don't save periodically
diff --git a/MekHQ/src/mekhq/MekHQOptions.java b/MekHQ/src/mekhq/MekHQOptions.java
index fada84f211..a1e4d6da07 100644
--- a/MekHQ/src/mekhq/MekHQOptions.java
+++ b/MekHQ/src/mekhq/MekHQOptions.java
@@ -20,12 +20,16 @@
import mekhq.gui.enums.PersonnelFilterStyle;
+import javax.swing.*;
+import java.awt.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.prefs.Preferences;
public final class MekHQOptions {
+ //region Variable Declarations
private static final Preferences userPreferences = Preferences.userRoot();
+ //endregion Variable Declarations
//region Display
public String getDisplayDateFormat() {
@@ -64,6 +68,7 @@ public void setHistoricalDailyLog(boolean value) {
userPreferences.node(MekHqConstants.DISPLAY_NODE).putBoolean(MekHqConstants.HISTORICAL_DAILY_LOG, value);
}
+ //region Expanded MekHQ Display Options
//region Command Center Display
public boolean getCommandCenterUseUnitMarket() {
return userPreferences.node(MekHqConstants.DISPLAY_NODE).getBoolean(MekHqConstants.COMMAND_CENTER_USE_UNIT_MARKET, true);
@@ -100,6 +105,255 @@ public void setPersonnelFilterOnPrimaryRole(boolean value) {
userPreferences.node(MekHqConstants.DISPLAY_NODE).putBoolean(MekHqConstants.PERSONNEL_FILTER_ON_PRIMARY_ROLE, value);
}
//endregion Personnel Tab Display Options
+ //endregion Expanded MekHQ Display Options
+
+ //region Colours
+ public Color getDeployedForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.DEPLOYED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setDeployedForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.DEPLOYED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getDeployedBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.DEPLOYED_BACKGROUND, Color.LIGHT_GRAY.getRGB()));
+ }
+
+ public void setDeployedBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.DEPLOYED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getBelowContractMinimumForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.BELOW_CONTRACT_MINIMUM_FOREGROUND, Color.RED.getRGB()));
+ }
+
+ public void setBelowContractMinimumForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.BELOW_CONTRACT_MINIMUM_FOREGROUND, value.getRGB());
+ }
+
+ public Color getBelowContractMinimumBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.BELOW_CONTRACT_MINIMUM_BACKGROUND, UIManager.getColor("Table.background").getRGB()));
+ }
+
+ public void setBelowContractMinimumBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.BELOW_CONTRACT_MINIMUM_BACKGROUND, value.getRGB());
+ }
+
+ public Color getInTransitForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.IN_TRANSIT_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setInTransitForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.IN_TRANSIT_FOREGROUND, value.getRGB());
+ }
+
+ public Color getInTransitBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.IN_TRANSIT_BACKGROUND, Color.MAGENTA.getRGB()));
+ }
+
+ public void setInTransitBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.IN_TRANSIT_BACKGROUND, value.getRGB());
+ }
+
+ public Color getRefittingForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.REFITTING_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setRefittingForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.REFITTING_FOREGROUND, value.getRGB());
+ }
+
+ public Color getRefittingBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.REFITTING_BACKGROUND, Color.CYAN.getRGB()));
+ }
+
+ public void setRefittingBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.REFITTING_BACKGROUND, value.getRGB());
+ }
+
+ public Color getMothballingForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.MOTHBALLING_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setMothballingForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.MOTHBALLING_FOREGROUND, value.getRGB());
+ }
+
+ public Color getMothballingBackground() {
+ // new Color(153, 153, 255)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.MOTHBALLING_BACKGROUND, 0xFF9999FF));
+ }
+
+ public void setMothballingBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.MOTHBALLING_BACKGROUND, value.getRGB());
+ }
+
+ public Color getMothballedForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.MOTHBALLED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setMothballedForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.MOTHBALLED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getMothballedBackground() {
+ // new Color(204, 204, 255)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.MOTHBALLED_BACKGROUND, 0xFFCCCCFF));
+ }
+
+ public void setMothballedBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.MOTHBALLED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getNotRepairableForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NOT_REPAIRABLE_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setNotRepairableForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NOT_REPAIRABLE_FOREGROUND, value.getRGB());
+ }
+
+ public Color getNotRepairableBackground() {
+ // new Color(190, 150, 55)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NOT_REPAIRABLE_BACKGROUND, 0xFFBE9637));
+ }
+
+ public void setNotRepairableBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NOT_REPAIRABLE_BACKGROUND, value.getRGB());
+ }
+
+ public Color getNonFunctionalForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NON_FUNCTIONAL_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setNonFunctionalForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NON_FUNCTIONAL_FOREGROUND, value.getRGB());
+ }
+
+ public Color getNonFunctionalBackground() {
+ // new Color(205, 92, 92)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NON_FUNCTIONAL_BACKGROUND, 0xFFCD5C5C));
+ }
+
+ public void setNonFunctionalBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NON_FUNCTIONAL_BACKGROUND, value.getRGB());
+ }
+
+ public Color getNeedsPartsFixedForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NEEDS_PARTS_FIXED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setNeedsPartsFixedForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NEEDS_PARTS_FIXED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getNeedsPartsFixedBackground() {
+ // new Color(238, 238, 0)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.NEEDS_PARTS_FIXED_BACKGROUND, 0xFFEEEE00));
+ }
+
+ public void setNeedsPartsFixedBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.NEEDS_PARTS_FIXED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getUnmaintainedForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.UNMAINTAINED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setUnmaintainedForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.UNMAINTAINED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getUnmaintainedBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.UNMAINTAINED_BACKGROUND, Color.ORANGE.getRGB()));
+ }
+
+ public void setUnmaintainedBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.UNMAINTAINED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getUncrewedForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.UNCREWED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setUncrewedForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.UNCREWED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getUncrewedBackground() {
+ // new Color(218, 130, 255)
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.UNCREWED_BACKGROUND, 0xFFDA82FF));
+ }
+
+ public void setUncrewedBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.UNCREWED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getLoanOverdueForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.LOAN_OVERDUE_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setLoanOverdueForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.LOAN_OVERDUE_FOREGROUND, value.getRGB());
+ }
+
+ public Color getLoanOverdueBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.LOAN_OVERDUE_BACKGROUND, Color.RED.getRGB()));
+ }
+
+ public void setLoanOverdueBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.LOAN_OVERDUE_BACKGROUND, value.getRGB());
+ }
+
+ public Color getInjuredForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.INJURED_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setInjuredForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.INJURED_FOREGROUND, value.getRGB());
+ }
+
+ public Color getInjuredBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.INJURED_BACKGROUND, Color.RED.getRGB()));
+ }
+
+ public void setInjuredBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.INJURED_BACKGROUND, value.getRGB());
+ }
+
+ public Color getHealedInjuriesForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.HEALED_INJURIES_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setHealedInjuriesForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.HEALED_INJURIES_FOREGROUND, value.getRGB());
+ }
+
+ public Color getHealedInjuriesBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.HEALED_INJURIES_BACKGROUND, 0xEE9A00));
+ }
+
+ public void setHealedInjuriesBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.HEALED_INJURIES_BACKGROUND, value.getRGB());
+ }
+
+ public Color getPaidRetirementForeground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.PAID_RETIREMENT_FOREGROUND, Color.BLACK.getRGB()));
+ }
+
+ public void setPaidRetirementForeground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.PAID_RETIREMENT_FOREGROUND, value.getRGB());
+ }
+
+ public Color getPaidRetirementBackground() {
+ return new Color(userPreferences.node(MekHqConstants.DISPLAY_NODE).getInt(MekHqConstants.PAID_RETIREMENT_BACKGROUND, Color.LIGHT_GRAY.getRGB()));
+ }
+
+ public void setPaidRetirementBackground(Color value) {
+ userPreferences.node(MekHqConstants.DISPLAY_NODE).putInt(MekHqConstants.PAID_RETIREMENT_BACKGROUND, value.getRGB());
+ }
+ //endregion Colours
//endregion Display
//region Autosave
diff --git a/MekHQ/src/mekhq/MekHqConstants.java b/MekHQ/src/mekhq/MekHqConstants.java
index 4286a449ce..44cc89711f 100644
--- a/MekHQ/src/mekhq/MekHqConstants.java
+++ b/MekHQ/src/mekhq/MekHqConstants.java
@@ -29,7 +29,7 @@ public final class MekHqConstants {
public static final String HISTORICAL_DAILY_LOG = "historicalDailyLog";
public static final int MAX_HISTORICAL_LOG_DAYS = 120; // max number of days that will be stored in the history, also used as a limit in the UI
- // region Command Center
+ //region Command Center
public static final String COMMAND_CENTER_USE_UNIT_MARKET = "commandCenterUseUnitMarket";
public static final String COMMAND_CENTER_MRMS = "commandCenterMRMS";
//endregion Command Center
@@ -38,6 +38,39 @@ public final class MekHqConstants {
public static final String PERSONNEL_FILTER_STYLE = "personnelFilterStyle";
public static final String PERSONNEL_FILTER_ON_PRIMARY_ROLE = "personnelFilterOnPrimaryRole";
//endregion Personnel Tab Display Options
+
+ //region Colours
+ public static final String DEPLOYED_FOREGROUND = "deployedForeground";
+ public static final String DEPLOYED_BACKGROUND = "deployedBackground";
+ public static final String BELOW_CONTRACT_MINIMUM_FOREGROUND = "belowContractMinimumForeground";
+ public static final String BELOW_CONTRACT_MINIMUM_BACKGROUND = "belowContractMinimumBackground";
+ public static final String IN_TRANSIT_FOREGROUND = "inTransitForeground";
+ public static final String IN_TRANSIT_BACKGROUND = "inTransitBackground";
+ public static final String REFITTING_FOREGROUND = "refittingForeground";
+ public static final String REFITTING_BACKGROUND = "refittingBackground";
+ public static final String MOTHBALLING_FOREGROUND = "mothballingForeground";
+ public static final String MOTHBALLING_BACKGROUND = "mothballingBackground";
+ public static final String MOTHBALLED_FOREGROUND = "mothballedForeground";
+ public static final String MOTHBALLED_BACKGROUND = "mothballedBackground";
+ public static final String NOT_REPAIRABLE_FOREGROUND = "notRepairableForeground";
+ public static final String NOT_REPAIRABLE_BACKGROUND = "notRepairableBackground";
+ public static final String NON_FUNCTIONAL_FOREGROUND = "nonFunctionalForeground";
+ public static final String NON_FUNCTIONAL_BACKGROUND = "nonFunctionalBackground";
+ public static final String NEEDS_PARTS_FIXED_FOREGROUND = "needsPartsFixedForeground";
+ public static final String NEEDS_PARTS_FIXED_BACKGROUND = "needsPartsFixedBackground";
+ public static final String UNMAINTAINED_FOREGROUND = "unmaintainedForeground";
+ public static final String UNMAINTAINED_BACKGROUND = "unmaintainedBackground";
+ public static final String UNCREWED_FOREGROUND = "uncrewedForeground";
+ public static final String UNCREWED_BACKGROUND = "uncrewedBackground";
+ public static final String LOAN_OVERDUE_FOREGROUND = "loanOverdueForeground";
+ public static final String LOAN_OVERDUE_BACKGROUND = "loanOverdueBackground";
+ public static final String INJURED_FOREGROUND = "injuredForeground";
+ public static final String INJURED_BACKGROUND = "injuredBackground";
+ public static final String HEALED_INJURIES_FOREGROUND = "healedInjuriesForeground";
+ public static final String HEALED_INJURIES_BACKGROUND = "healedInjuriesBackground";
+ public static final String PAID_RETIREMENT_FOREGROUND = "paidRetirementForeground";
+ public static final String PAID_RETIREMENT_BACKGROUND = "paidRetirementBackground";
+ //endregion Colours
//endregion Display
//region Autosave
diff --git a/MekHQ/src/mekhq/gui/ForceRenderer.java b/MekHQ/src/mekhq/gui/ForceRenderer.java
index ce0627e6cd..e682d1a7eb 100644
--- a/MekHQ/src/mekhq/gui/ForceRenderer.java
+++ b/MekHQ/src/mekhq/gui/ForceRenderer.java
@@ -35,13 +35,15 @@
import mekhq.campaign.unit.Unit;
public class ForceRenderer extends DefaultTreeCellRenderer {
+ //region Variable Declarations
private static final long serialVersionUID = -553191867660269247L;
+ //endregion Variable Declarations
- private final MekHqColors colors = new MekHqColors();
-
+ //region Constructors
public ForceRenderer() {
}
+ //endregion Constructors
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel,
@@ -133,14 +135,14 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
}
setText("" + name + ", " + uname + c3network + transport + "");
if (!sel && u.isDeployed()) {
- colors.getDeployed().getColor().ifPresent(this::setBackground);
- colors.getDeployed().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getDeployedForeground());
+ setBackground(MekHQ.getMekHQOptions().getDeployedBackground());
setOpaque(true);
}
} else if (value instanceof Force) {
if (!sel && ((Force) value).isDeployed()) {
- colors.getDeployed().getColor().ifPresent(this::setBackground);
- colors.getDeployed().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getDeployedForeground());
+ setBackground(MekHQ.getMekHQOptions().getDeployedBackground());
setOpaque(true);
}
} else {
diff --git a/MekHQ/src/mekhq/gui/MekHqColors.java b/MekHQ/src/mekhq/gui/MekHqColors.java
deleted file mode 100644
index 6fe7f4265a..0000000000
--- a/MekHQ/src/mekhq/gui/MekHqColors.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2020 - The MegaMek Team. All Rights Reserved.
- *
- * This file is part of MekHQ.
- *
- * MekHQ is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MekHQ is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MekHQ. If not, see .
- */
-package mekhq.gui;
-
-import java.awt.Color;
-
-import javax.swing.UIManager;
-
-import mekhq.MekHQ;
-import mekhq.gui.preferences.ColorPreference;
-import megamek.client.ui.preferences.PreferencesNode;
-
-public class MekHqColors {
-
- //
- // General Colors
- //
-
- private static ColorPreference iconButtonColors;
-
- //
- // Force Colors
- //
-
- private static ColorPreference deployedColors;
- private static ColorPreference belowContractMinimumColors;
-
- //
- // Unit Colors
- //
-
- private static ColorPreference inTransitColors;
- private static ColorPreference refittingColors;
- private static ColorPreference mothballingColors;
- private static ColorPreference mothballedColors;
- private static ColorPreference notRepairableColors;
- private static ColorPreference nonfunctionalColors;
- private static ColorPreference needsPartsFixedColors;
- private static ColorPreference unmaintainedColors;
- private static ColorPreference uncrewedColors;
-
- //
- // Financial Colors
- //
-
- private static ColorPreference loanOverdueColors;
-
- //
- // Personnel Colors
- //
-
- private static ColorPreference injuredColors;
- private static ColorPreference healedInjuriesColors;
- private static ColorPreference paidRetirementColors;
-
- static {
- final PreferencesNode preferences = MekHQ.getPreferences().forClass(MekHqColors.class);
-
- iconButtonColors = new ColorPreference("iconButton", Color.LIGHT_GRAY, Color.BLACK);
-
- deployedColors = new ColorPreference("deployed", Color.LIGHT_GRAY, Color.BLACK);
- belowContractMinimumColors = new ColorPreference("belowContractMinimum", UIManager.getColor("Table.background"), Color.RED);
-
- inTransitColors = new ColorPreference("inTransit", Color.MAGENTA, Color.BLACK);
- refittingColors = new ColorPreference("refitting", Color.CYAN, Color.BLACK);
- mothballingColors = new ColorPreference("mothballing", new Color(153,153,255), Color.BLACK);
- mothballedColors = new ColorPreference("mothballed", new Color(204, 204, 255), Color.BLACK);
- notRepairableColors = new ColorPreference("notRepairable", new Color(190, 150, 55), Color.BLACK);
- nonfunctionalColors = new ColorPreference("nonfunctional", new Color(205, 92, 92), Color.BLACK);
- needsPartsFixedColors = new ColorPreference("needsPartsFixed", new Color(238, 238, 0), Color.BLACK);
- unmaintainedColors = new ColorPreference("unmaintainedColors", Color.ORANGE, Color.BLACK);
- uncrewedColors = new ColorPreference("uncrewed", new Color(218, 130, 255), Color.BLACK);
-
- loanOverdueColors = new ColorPreference("loanOverdue", Color.RED, Color.BLACK);
-
- injuredColors = new ColorPreference("injured", Color.RED, Color.BLACK);
- healedInjuriesColors = new ColorPreference("healed", new Color(0xee9a00), Color.BLACK);
- paidRetirementColors = new ColorPreference("paidRetirement", Color.LIGHT_GRAY, Color.BLACK);
-
- preferences.manage(iconButtonColors, deployedColors, belowContractMinimumColors,
- inTransitColors, refittingColors, mothballingColors, mothballedColors,
- notRepairableColors, nonfunctionalColors, needsPartsFixedColors, unmaintainedColors,
- uncrewedColors, loanOverdueColors, injuredColors, healedInjuriesColors,
- paidRetirementColors);
- }
-
- public ColorPreference getIconButton() {
- return iconButtonColors;
- }
-
- public ColorPreference getDeployed() {
- return deployedColors;
- }
-
- public ColorPreference getBelowContractMinimum() {
- return belowContractMinimumColors;
- }
-
- public ColorPreference getInTransit() {
- return inTransitColors;
- }
-
- public ColorPreference getRefitting() {
- return refittingColors;
- }
-
- public ColorPreference getMothballing() {
- return mothballingColors;
- }
-
- public ColorPreference getMothballed() {
- return mothballedColors;
- }
-
- public ColorPreference getNotRepairable() {
- return notRepairableColors;
- }
-
- public ColorPreference getNonFunctional() {
- return nonfunctionalColors;
- }
-
- public ColorPreference getNeedsPartsFixed() {
- return needsPartsFixedColors;
- }
-
- public ColorPreference getUnmaintained() {
- return unmaintainedColors;
- }
-
- public ColorPreference getUncrewed() {
- return uncrewedColors;
- }
-
- public ColorPreference getLoanOverdue() {
- return loanOverdueColors;
- }
-
- public ColorPreference getInjured() {
- return injuredColors;
- }
-
- public ColorPreference getHealedInjuries() {
- return healedInjuriesColors;
- }
-
- public ColorPreference getPaidRetirement() {
- return paidRetirementColors;
- }
-}
diff --git a/MekHQ/src/mekhq/gui/dialog/MekHqOptionsDialog.java b/MekHQ/src/mekhq/gui/dialog/MekHqOptionsDialog.java
index 73019758ea..0642a1d09f 100644
--- a/MekHQ/src/mekhq/gui/dialog/MekHqOptionsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MekHqOptionsDialog.java
@@ -18,6 +18,7 @@
*/
package mekhq.gui.dialog;
+import megamek.client.ui.swing.ColourSelectorButton;
import megamek.common.util.EncodeControl;
import mekhq.MekHQ;
import mekhq.campaign.event.MekHQOptionsChangedEvent;
@@ -48,6 +49,39 @@ public class MekHqOptionsDialog extends AbstractMHQButtonDialog {
private JComboBox optionPersonnelFilterStyle;
private JCheckBox optionPersonnelFilterOnPrimaryRole;
//endregion Personnel Tab Display Options
+
+ //region Colors
+ private ColourSelectorButton optionDeployedForeground;
+ private ColourSelectorButton optionDeployedBackground;
+ private ColourSelectorButton optionBelowContractMinimumForeground;
+ private ColourSelectorButton optionBelowContractMinimumBackground;
+ private ColourSelectorButton optionInTransitForeground;
+ private ColourSelectorButton optionInTransitBackground;
+ private ColourSelectorButton optionRefittingForeground;
+ private ColourSelectorButton optionRefittingBackground;
+ private ColourSelectorButton optionMothballingForeground;
+ private ColourSelectorButton optionMothballingBackground;
+ private ColourSelectorButton optionMothballedForeground;
+ private ColourSelectorButton optionMothballedBackground;
+ private ColourSelectorButton optionNotRepairableForeground;
+ private ColourSelectorButton optionNotRepairableBackground;
+ private ColourSelectorButton optionNonFunctionalForeground;
+ private ColourSelectorButton optionNonFunctionalBackground;
+ private ColourSelectorButton optionNeedsPartsFixedForeground;
+ private ColourSelectorButton optionNeedsPartsFixedBackground;
+ private ColourSelectorButton optionUnmaintainedForeground;
+ private ColourSelectorButton optionUnmaintainedBackground;
+ private ColourSelectorButton optionUncrewedForeground;
+ private ColourSelectorButton optionUncrewedBackground;
+ private ColourSelectorButton optionLoanOverdueForeground;
+ private ColourSelectorButton optionLoanOverdueBackground;
+ private ColourSelectorButton optionInjuredForeground;
+ private ColourSelectorButton optionInjuredBackground;
+ private ColourSelectorButton optionHealedInjuriesForeground;
+ private ColourSelectorButton optionHealedInjuriesBackground;
+ private ColourSelectorButton optionPaidRetirementForeground;
+ private ColourSelectorButton optionPaidRetirementBackground;
+ //endregion Colors
//endregion Display
//region Autosave
@@ -94,6 +128,7 @@ protected Container createCenterPane() {
JTabbedPane optionsTabbedPane = new JTabbedPane();
optionsTabbedPane.setName("optionsTabbedPane");
optionsTabbedPane.add(resources.getString("displayTab.title"), new JScrollPane(createDisplayTab()));
+ optionsTabbedPane.add(resources.getString("displayColourTab.title"), new JScrollPane(createDisplayColourTab()));
optionsTabbedPane.add(resources.getString("autosaveTab.title"), new JScrollPane(createAutosaveTab()));
optionsTabbedPane.add(resources.getString("newDayTab.title"), new JScrollPane(createNewDayTab()));
optionsTabbedPane.add(resources.getString("campaignXMLSaveTab.title"), new JScrollPane(createCampaignXMLSaveTab()));
@@ -216,6 +251,180 @@ public Component getListCellRendererComponent(JList> list, Object value, int i
return body;
}
+ private JPanel createDisplayColourTab() {
+ //region Create Graphical Components
+ optionDeployedForeground = new ColourSelectorButton(resources.getString("optionDeployedForeground.text"));
+
+ optionDeployedBackground = new ColourSelectorButton(resources.getString("optionDeployedBackground.text"));
+
+ optionBelowContractMinimumForeground = new ColourSelectorButton(resources.getString("optionBelowContractMinimumForeground.text"));
+
+ optionBelowContractMinimumBackground = new ColourSelectorButton(resources.getString("optionBelowContractMinimumBackground.text"));
+
+ optionInTransitForeground = new ColourSelectorButton(resources.getString("optionInTransitForeground.text"));
+
+ optionInTransitBackground = new ColourSelectorButton(resources.getString("optionInTransitBackground.text"));
+
+ optionRefittingForeground = new ColourSelectorButton(resources.getString("optionRefittingForeground.text"));
+
+ optionRefittingBackground = new ColourSelectorButton(resources.getString("optionRefittingBackground.text"));
+
+ optionMothballingForeground = new ColourSelectorButton(resources.getString("optionMothballingForeground.text"));
+
+ optionMothballingBackground = new ColourSelectorButton(resources.getString("optionMothballingBackground.text"));
+
+ optionMothballedForeground = new ColourSelectorButton(resources.getString("optionMothballedForeground.text"));
+
+ optionMothballedBackground = new ColourSelectorButton(resources.getString("optionMothballedBackground.text"));
+
+ optionNotRepairableForeground = new ColourSelectorButton(resources.getString("optionNotRepairableForeground.text"));
+
+ optionNotRepairableBackground = new ColourSelectorButton(resources.getString("optionNotRepairableBackground.text"));
+
+ optionNonFunctionalForeground = new ColourSelectorButton(resources.getString("optionNonFunctionalForeground.text"));
+
+ optionNonFunctionalBackground = new ColourSelectorButton(resources.getString("optionNonFunctionalBackground.text"));
+
+ optionNeedsPartsFixedForeground = new ColourSelectorButton(resources.getString("optionNeedsPartsFixedForeground.text"));
+
+ optionNeedsPartsFixedBackground = new ColourSelectorButton(resources.getString("optionNeedsPartsFixedBackground.text"));
+
+ optionUnmaintainedForeground = new ColourSelectorButton(resources.getString("optionUnmaintainedForeground.text"));
+
+ optionUnmaintainedBackground = new ColourSelectorButton(resources.getString("optionUnmaintainedBackground.text"));
+
+ optionUncrewedForeground = new ColourSelectorButton(resources.getString("optionUncrewedForeground.text"));
+
+ optionUncrewedBackground = new ColourSelectorButton(resources.getString("optionUncrewedBackground.text"));
+
+ optionLoanOverdueForeground = new ColourSelectorButton(resources.getString("optionLoanOverdueForeground.text"));
+
+ optionLoanOverdueBackground = new ColourSelectorButton(resources.getString("optionLoanOverdueBackground.text"));
+
+ optionInjuredForeground = new ColourSelectorButton(resources.getString("optionInjuredForeground.text"));
+
+ optionInjuredBackground = new ColourSelectorButton(resources.getString("optionInjuredBackground.text"));
+
+ optionHealedInjuriesForeground = new ColourSelectorButton(resources.getString("optionHealedInjuriesForeground.text"));
+
+ optionHealedInjuriesBackground = new ColourSelectorButton(resources.getString("optionHealedInjuriesBackground.text"));
+
+ optionPaidRetirementForeground = new ColourSelectorButton(resources.getString("optionPaidRetirementForeground.text"));
+
+ optionPaidRetirementBackground = new ColourSelectorButton(resources.getString("optionPaidRetirementBackground.text"));
+ //endregion Create Graphical Components
+
+ //region Layout
+ // Layout the UI
+ JPanel body = new JPanel();
+ GroupLayout layout = new GroupLayout(body);
+ body.setLayout(layout);
+
+ layout.setAutoCreateGaps(true);
+ layout.setAutoCreateContainerGaps(true);
+
+ layout.setVerticalGroup(
+ layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionDeployedForeground)
+ .addComponent(optionDeployedBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionBelowContractMinimumForeground)
+ .addComponent(optionBelowContractMinimumBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionInTransitForeground)
+ .addComponent(optionInTransitBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionRefittingForeground)
+ .addComponent(optionRefittingBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionMothballingForeground)
+ .addComponent(optionMothballingBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionMothballedForeground)
+ .addComponent(optionMothballedBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionNotRepairableForeground)
+ .addComponent(optionNotRepairableBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionNonFunctionalForeground)
+ .addComponent(optionNonFunctionalBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionNeedsPartsFixedForeground)
+ .addComponent(optionNeedsPartsFixedBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionUnmaintainedForeground)
+ .addComponent(optionUnmaintainedBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionUncrewedForeground)
+ .addComponent(optionUncrewedBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionLoanOverdueForeground)
+ .addComponent(optionLoanOverdueBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionInjuredForeground)
+ .addComponent(optionInjuredBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionHealedInjuriesForeground)
+ .addComponent(optionHealedInjuriesBackground, GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(optionPaidRetirementForeground)
+ .addComponent(optionPaidRetirementBackground, GroupLayout.Alignment.TRAILING))
+ );
+
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionDeployedForeground)
+ .addComponent(optionDeployedBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionBelowContractMinimumForeground)
+ .addComponent(optionBelowContractMinimumBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionInTransitForeground)
+ .addComponent(optionInTransitBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionRefittingForeground)
+ .addComponent(optionRefittingBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionMothballingForeground)
+ .addComponent(optionMothballingBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionMothballedForeground)
+ .addComponent(optionMothballedBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionNotRepairableForeground)
+ .addComponent(optionNotRepairableBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionNonFunctionalForeground)
+ .addComponent(optionNonFunctionalBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionNeedsPartsFixedForeground)
+ .addComponent(optionNeedsPartsFixedBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionUnmaintainedForeground)
+ .addComponent(optionUnmaintainedBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionUncrewedForeground)
+ .addComponent(optionUncrewedBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionLoanOverdueForeground)
+ .addComponent(optionLoanOverdueBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionInjuredForeground)
+ .addComponent(optionInjuredBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionHealedInjuriesForeground)
+ .addComponent(optionHealedInjuriesBackground))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(optionPaidRetirementForeground)
+ .addComponent(optionPaidRetirementBackground))
+ );
+ //endregion Layout
+
+ return body;
+ }
+
private JPanel createAutosaveTab() {
//region Create Graphical Components
optionNoSave = new JRadioButton(resources.getString("optionNoSave.text"));
@@ -408,6 +617,37 @@ protected void okAction() {
MekHQ.getMekHQOptions().setPersonnelFilterStyle((PersonnelFilterStyle) Objects.requireNonNull(optionPersonnelFilterStyle.getSelectedItem()));
MekHQ.getMekHQOptions().setPersonnelFilterOnPrimaryRole(optionPersonnelFilterOnPrimaryRole.isSelected());
+ MekHQ.getMekHQOptions().setDeployedForeground(optionDeployedForeground.getColour());
+ MekHQ.getMekHQOptions().setDeployedBackground(optionDeployedBackground.getColour());
+ MekHQ.getMekHQOptions().setBelowContractMinimumForeground(optionBelowContractMinimumForeground.getColour());
+ MekHQ.getMekHQOptions().setBelowContractMinimumBackground(optionBelowContractMinimumBackground.getColour());
+ MekHQ.getMekHQOptions().setInTransitForeground(optionInTransitForeground.getColour());
+ MekHQ.getMekHQOptions().setInTransitBackground(optionInTransitBackground.getColour());
+ MekHQ.getMekHQOptions().setRefittingForeground(optionRefittingForeground.getColour());
+ MekHQ.getMekHQOptions().setRefittingBackground(optionRefittingBackground.getColour());
+ MekHQ.getMekHQOptions().setMothballingForeground(optionMothballingForeground.getColour());
+ MekHQ.getMekHQOptions().setMothballingBackground(optionMothballingBackground.getColour());
+ MekHQ.getMekHQOptions().setMothballedForeground(optionMothballedForeground.getColour());
+ MekHQ.getMekHQOptions().setMothballedBackground(optionMothballedBackground.getColour());
+ MekHQ.getMekHQOptions().setNotRepairableForeground(optionNotRepairableForeground.getColour());
+ MekHQ.getMekHQOptions().setNotRepairableBackground(optionNotRepairableBackground.getColour());
+ MekHQ.getMekHQOptions().setNonFunctionalForeground(optionNonFunctionalForeground.getColour());
+ MekHQ.getMekHQOptions().setNonFunctionalBackground(optionNonFunctionalBackground.getColour());
+ MekHQ.getMekHQOptions().setNeedsPartsFixedForeground(optionNeedsPartsFixedForeground.getColour());
+ MekHQ.getMekHQOptions().setNeedsPartsFixedBackground(optionNeedsPartsFixedBackground.getColour());
+ MekHQ.getMekHQOptions().setUnmaintainedForeground(optionUnmaintainedForeground.getColour());
+ MekHQ.getMekHQOptions().setUnmaintainedBackground(optionUnmaintainedBackground.getColour());
+ MekHQ.getMekHQOptions().setUncrewedForeground(optionUncrewedForeground.getColour());
+ MekHQ.getMekHQOptions().setUncrewedBackground(optionUncrewedBackground.getColour());
+ MekHQ.getMekHQOptions().setLoanOverdueForeground(optionLoanOverdueForeground.getColour());
+ MekHQ.getMekHQOptions().setLoanOverdueBackground(optionLoanOverdueBackground.getColour());
+ MekHQ.getMekHQOptions().setInjuredForeground(optionInjuredForeground.getColour());
+ MekHQ.getMekHQOptions().setInjuredBackground(optionInjuredBackground.getColour());
+ MekHQ.getMekHQOptions().setHealedInjuriesForeground(optionHealedInjuriesForeground.getColour());
+ MekHQ.getMekHQOptions().setHealedInjuriesBackground(optionHealedInjuriesBackground.getColour());
+ MekHQ.getMekHQOptions().setPaidRetirementForeground(optionPaidRetirementForeground.getColour());
+ MekHQ.getMekHQOptions().setPaidRetirementBackground(optionPaidRetirementBackground.getColour());
+
MekHQ.getMekHQOptions().setNoAutosaveValue(optionNoSave.isSelected());
MekHQ.getMekHQOptions().setAutosaveDailyValue(optionSaveDaily.isSelected());
MekHQ.getMekHQOptions().setAutosaveWeeklyValue(optionSaveWeekly.isSelected());
@@ -436,6 +676,37 @@ private void setInitialState() {
optionPersonnelFilterStyle.setSelectedItem(MekHQ.getMekHQOptions().getPersonnelFilterStyle());
optionPersonnelFilterOnPrimaryRole.setSelected(MekHQ.getMekHQOptions().getPersonnelFilterOnPrimaryRole());
+ optionDeployedForeground.setColour(MekHQ.getMekHQOptions().getDeployedForeground());
+ optionDeployedBackground.setColour(MekHQ.getMekHQOptions().getDeployedBackground());
+ optionBelowContractMinimumForeground.setColour(MekHQ.getMekHQOptions().getBelowContractMinimumForeground());
+ optionBelowContractMinimumBackground.setColour(MekHQ.getMekHQOptions().getBelowContractMinimumBackground());
+ optionInTransitForeground.setColour(MekHQ.getMekHQOptions().getInTransitForeground());
+ optionInTransitBackground.setColour(MekHQ.getMekHQOptions().getInTransitBackground());
+ optionRefittingForeground.setColour(MekHQ.getMekHQOptions().getRefittingForeground());
+ optionRefittingBackground.setColour(MekHQ.getMekHQOptions().getRefittingBackground());
+ optionMothballingForeground.setColour(MekHQ.getMekHQOptions().getMothballingForeground());
+ optionMothballingBackground.setColour(MekHQ.getMekHQOptions().getMothballingBackground());
+ optionMothballedForeground.setColour(MekHQ.getMekHQOptions().getMothballedForeground());
+ optionMothballedBackground.setColour(MekHQ.getMekHQOptions().getMothballedBackground());
+ optionNotRepairableForeground.setColour(MekHQ.getMekHQOptions().getNotRepairableForeground());
+ optionNotRepairableBackground.setColour(MekHQ.getMekHQOptions().getNotRepairableBackground());
+ optionNonFunctionalForeground.setColour(MekHQ.getMekHQOptions().getNonFunctionalForeground());
+ optionNonFunctionalBackground.setColour(MekHQ.getMekHQOptions().getNonFunctionalBackground());
+ optionNeedsPartsFixedForeground.setColour(MekHQ.getMekHQOptions().getNeedsPartsFixedForeground());
+ optionNeedsPartsFixedBackground.setColour(MekHQ.getMekHQOptions().getNeedsPartsFixedBackground());
+ optionUnmaintainedForeground.setColour(MekHQ.getMekHQOptions().getUnmaintainedForeground());
+ optionUnmaintainedBackground.setColour(MekHQ.getMekHQOptions().getUnmaintainedBackground());
+ optionUncrewedForeground.setColour(MekHQ.getMekHQOptions().getUncrewedForeground());
+ optionUncrewedBackground.setColour(MekHQ.getMekHQOptions().getUncrewedBackground());
+ optionLoanOverdueForeground.setColour(MekHQ.getMekHQOptions().getLoanOverdueForeground());
+ optionLoanOverdueBackground.setColour(MekHQ.getMekHQOptions().getLoanOverdueBackground());
+ optionInjuredForeground.setColour(MekHQ.getMekHQOptions().getInjuredForeground());
+ optionInjuredBackground.setColour(MekHQ.getMekHQOptions().getInjuredBackground());
+ optionHealedInjuriesForeground.setColour(MekHQ.getMekHQOptions().getHealedInjuriesForeground());
+ optionHealedInjuriesBackground.setColour(MekHQ.getMekHQOptions().getHealedInjuriesBackground());
+ optionPaidRetirementForeground.setColour(MekHQ.getMekHQOptions().getPaidRetirementForeground());
+ optionPaidRetirementBackground.setColour(MekHQ.getMekHQOptions().getPaidRetirementBackground());
+
optionNoSave.setSelected(MekHQ.getMekHQOptions().getNoAutosaveValue());
optionSaveDaily.setSelected(MekHQ.getMekHQOptions().getAutosaveDailyValue());
optionSaveWeekly.setSelected(MekHQ.getMekHQOptions().getAutosaveWeeklyValue());
diff --git a/MekHQ/src/mekhq/gui/model/LoanTableModel.java b/MekHQ/src/mekhq/gui/model/LoanTableModel.java
index ef603fae83..ef1f757aaf 100644
--- a/MekHQ/src/mekhq/gui/model/LoanTableModel.java
+++ b/MekHQ/src/mekhq/gui/model/LoanTableModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 - The MegaMek Team. All Rights Reserved
+ * Copyright (c) 2013-2020 - The MegaMek Team. All Rights Reserved
*
* This file is part of MekHQ.
*
@@ -29,7 +29,6 @@
import mekhq.MekHQ;
import mekhq.campaign.finances.Finances;
import mekhq.campaign.finances.Loan;
-import mekhq.gui.MekHqColors;
/**
* A table model for displaying active loans
@@ -48,8 +47,6 @@ public class LoanTableModel extends DataTableModel {
public final static int COL_NEXT_PAY = 8;
public final static int N_COL = 9;
- private static final transient MekHqColors colors = new MekHqColors();
-
public LoanTableModel() {
data = new ArrayList();
}
@@ -175,8 +172,8 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
setForeground(UIManager.getColor("Table.selectionForeground"));
} else {
if (loan.isOverdue()) {
- colors.getLoanOverdue().getColor().ifPresent(this::setBackground);
- colors.getLoanOverdue().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getLoanOverdueForeground());
+ setBackground(MekHQ.getMekHQOptions().getLoanOverdueBackground());
} else {
setBackground(UIManager.getColor("Table.background"));
}
diff --git a/MekHQ/src/mekhq/gui/model/PersonnelTableModel.java b/MekHQ/src/mekhq/gui/model/PersonnelTableModel.java
index 1e479d81b6..eb483eeb39 100644
--- a/MekHQ/src/mekhq/gui/model/PersonnelTableModel.java
+++ b/MekHQ/src/mekhq/gui/model/PersonnelTableModel.java
@@ -37,6 +37,7 @@
import megamek.common.options.PilotOptions;
import megamek.common.util.EncodeControl;
import megamek.common.util.StringUtil;
+import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.force.Force;
import mekhq.campaign.market.PersonnelMarket;
@@ -46,7 +47,6 @@
import mekhq.campaign.unit.Unit;
import mekhq.campaign.universe.Planet;
import mekhq.gui.BasicInfo;
-import mekhq.gui.MekHqColors;
import mekhq.gui.utilities.MekHqTableCellRenderer;
/**
@@ -62,7 +62,6 @@ public class PersonnelTableModel extends DataTableModel {
private boolean loadAssignmentFromMarket;
private boolean groupByUnit;
- private final MekHqColors colors = new MekHqColors();
public static final int COL_RANK = 0;
public static final int COL_GIVEN_NAME = 1;
@@ -697,15 +696,15 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
if (!isSelected) {
if (isDeployed(actualRow)) {
- colors.getDeployed().getColor().ifPresent(this::setBackground);
- colors.getDeployed().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getDeployedForeground());
+ setBackground(MekHQ.getMekHQOptions().getDeployedBackground());
} else if ((Integer.parseInt((String) getValueAt(actualRow, COL_HITS)) > 0)
|| getPerson(actualRow).hasInjuries(true)) {
- colors.getInjured().getColor().ifPresent(this::setBackground);
- colors.getInjured().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getInjuredForeground());
+ setBackground(MekHQ.getMekHQOptions().getInjuredBackground());
} else if (getPerson(actualRow).hasOnlyHealedPermanentInjuries()) {
- colors.getHealedInjuries().getColor().ifPresent(this::setBackground);
- colors.getHealedInjuries().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getHealedInjuriesForeground());
+ setBackground(MekHQ.getMekHQOptions().getHealedInjuriesBackground());
} else {
setBackground(UIManager.getColor("Table.background"));
setForeground(UIManager.getColor("Table.foreground"));
diff --git a/MekHQ/src/mekhq/gui/model/RetirementTableModel.java b/MekHQ/src/mekhq/gui/model/RetirementTableModel.java
index ae899c503d..2c62490604 100644
--- a/MekHQ/src/mekhq/gui/model/RetirementTableModel.java
+++ b/MekHQ/src/mekhq/gui/model/RetirementTableModel.java
@@ -4,6 +4,8 @@
import java.awt.Image;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import javax.swing.JTable;
@@ -26,7 +28,6 @@
import mekhq.campaign.personnel.RetirementDefectionTracker;
import mekhq.campaign.unit.Unit;
import mekhq.gui.BasicInfo;
-import mekhq.gui.MekHqColors;
import mekhq.gui.dialog.RetirementDefectionDialog;
import mekhq.gui.utilities.MekHqTableCellRenderer;
@@ -53,14 +54,13 @@ public class RetirementTableModel extends AbstractTableModel {
};
private final Campaign campaign;
- private final MekHqColors colors = new MekHqColors();
- private ArrayList data;
- private HashMap targets;
- private HashMap payBonus;
- private HashMap miscMods;
+ private List data;
+ private Map targets;
+ private Map payBonus;
+ private Map miscMods;
private int generalMod;
- private HashMap unitAssignments;
- private HashMap altPayout;
+ private Map unitAssignments;
+ private Map altPayout;
boolean editPayout;
public RetirementTableModel(Campaign c) {
@@ -298,8 +298,7 @@ public Object getValueAt(int row, int col) {
campaign.getRetirementDefectionTracker().getPayout(data.get(row));
if (null == pay) {
return "";
- }
- if (pay.getDependents() > 0) {
+ } else if (pay.getDependents() > 0) {
return pay.getDependents() + " Dependents";
} else if (pay.hasRecruit()) {
return Person.getRoleDesc(pay.getRecruitType(),
@@ -363,7 +362,7 @@ public void setGeneralMod(int mod) {
fireTableDataChanged();
}
- public HashMap getAltPayout() {
+ public Map getAltPayout() {
return altPayout;
}
@@ -380,14 +379,11 @@ public TableCellRenderer getRenderer(int col) {
}
public class TextRenderer extends MekHqTableCellRenderer {
- /**
- *
- */
private static final long serialVersionUID = 770305943352316265L;
- public Component getTableCellRendererComponent(JTable table,
- Object value, boolean isSelected, boolean hasFocus,
- int row, int column) {
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
+ boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
int actualRow = table.convertRowIndexToModel(row);
@@ -397,8 +393,8 @@ public Component getTableCellRendererComponent(JTable table,
if (!isSelected) {
if (null != campaign.getRetirementDefectionTracker().getPayout(p.getId()) &&
campaign.getRetirementDefectionTracker().getPayout(p.getId()).getWeightClass() > 0) {
- colors.getPaidRetirement().getColor().ifPresent(this::setBackground);
- colors.getPaidRetirement().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getPaidRetirementForeground());
+ setBackground(MekHQ.getMekHQOptions().getPaidRetirementBackground());
}
}
return this;
@@ -422,12 +418,12 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
if (actualCol == COL_PERSON) {
setPortrait(p);
setText(p.getFullDesc());
- }
- if (actualCol == COL_ASSIGN) {
+ } else if (actualCol == COL_ASSIGN) {
Unit u = p.getUnit();
if (!p.getTechUnits().isEmpty()) {
u = p.getTechUnits().get(0);
}
+
if (null != u) {
String desc = "" + u.getName() + "
";
desc += u.getEntity().getWeightClassName();
@@ -445,8 +441,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
} else {
clearImage();
}
- }
- if (actualCol == COL_FORCE) {
+ } else if (actualCol == COL_FORCE) {
Force force = campaign.getForceFor(p);
if (null != force) {
String desc = "" + force.getName() + "";
@@ -473,10 +468,10 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
MekHqTableCellRenderer.setupTableColors(this, table, isSelected, hasFocus, row);
if (!isSelected) {
- if (null != campaign.getRetirementDefectionTracker().getPayout(p.getId()) &&
- campaign.getRetirementDefectionTracker().getPayout(p.getId()).getWeightClass() > 0) {
- colors.getPaidRetirement().getColor().ifPresent(this::setBackground);
- colors.getPaidRetirement().getAlternateColor().ifPresent(this::setForeground);
+ if ((campaign.getRetirementDefectionTracker().getPayout(p.getId()) != null)
+ && (campaign.getRetirementDefectionTracker().getPayout(p.getId()).getWeightClass() > 0)) {
+ setForeground(MekHQ.getMekHQOptions().getPaidRetirementForeground());
+ setBackground(MekHQ.getMekHQOptions().getPaidRetirementBackground());
}
}
diff --git a/MekHQ/src/mekhq/gui/model/UnitTableModel.java b/MekHQ/src/mekhq/gui/model/UnitTableModel.java
index 32dd44beca..65829f45af 100644
--- a/MekHQ/src/mekhq/gui/model/UnitTableModel.java
+++ b/MekHQ/src/mekhq/gui/model/UnitTableModel.java
@@ -33,13 +33,12 @@
import megamek.common.SmallCraft;
import megamek.common.TechConstants;
import megamek.common.UnitType;
+import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.force.Force;
import mekhq.campaign.personnel.Person;
import mekhq.campaign.unit.Unit;
import mekhq.gui.BasicInfo;
-import mekhq.gui.MekHqColors;
-import mekhq.gui.preferences.ColorPreference;
import mekhq.gui.utilities.MekHqTableCellRenderer;
/**
@@ -72,8 +71,6 @@ public class UnitTableModel extends DataTableModel {
public final static int N_COL = 19;
private Campaign campaign;
-
- private final MekHqColors colors = new MekHqColors();
//endregion Variable Declarations
public UnitTableModel(Campaign c) {
@@ -285,25 +282,35 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
if (!isSelected) {
if (u.isDeployed()) {
- applyColors(colors.getDeployed());
+ setForeground(MekHQ.getMekHQOptions().getDeployedForeground());
+ setBackground(MekHQ.getMekHQOptions().getDeployedBackground());
} else if (!u.isPresent()) {
- applyColors(colors.getInTransit());
+ setForeground(MekHQ.getMekHQOptions().getInTransitForeground());
+ setBackground(MekHQ.getMekHQOptions().getInTransitBackground());
} else if (u.isRefitting()) {
- applyColors(colors.getRefitting());
+ setForeground(MekHQ.getMekHQOptions().getRefittingForeground());
+ setBackground(MekHQ.getMekHQOptions().getRefittingBackground());
} else if (u.isMothballing()) {
- applyColors(colors.getMothballing());
+ setForeground(MekHQ.getMekHQOptions().getMothballingForeground());
+ setBackground(MekHQ.getMekHQOptions().getMothballingBackground());
} else if (u.isMothballed()) {
- applyColors(colors.getMothballed());
+ setForeground(MekHQ.getMekHQOptions().getMothballedForeground());
+ setBackground(MekHQ.getMekHQOptions().getMothballedBackground());
} else if (u.isUnmaintained()) {
- applyColors(colors.getUnmaintained());
+ setForeground(MekHQ.getMekHQOptions().getUnmaintainedForeground());
+ setBackground(MekHQ.getMekHQOptions().getUnmaintainedBackground());
} else if (!u.isRepairable()) {
- applyColors(colors.getNotRepairable());
+ setForeground(MekHQ.getMekHQOptions().getNotRepairableForeground());
+ setBackground(MekHQ.getMekHQOptions().getNotRepairableBackground());
} else if (!u.isFunctional()) {
- applyColors(colors.getNonFunctional());
+ setForeground(MekHQ.getMekHQOptions().getNonFunctionalForeground());
+ setBackground(MekHQ.getMekHQOptions().getNonFunctionalBackground());
} else if (u.hasPartsNeedingFixing()) {
- applyColors(colors.getNeedsPartsFixed());
+ setForeground(MekHQ.getMekHQOptions().getNeedsPartsFixedForeground());
+ setBackground(MekHQ.getMekHQOptions().getNeedsPartsFixedBackground());
} else if (u.getActiveCrew().size() < u.getFullCrewSize()) {
- applyColors(colors.getUncrewed());
+ setForeground(MekHQ.getMekHQOptions().getUncrewedForeground());
+ setBackground(MekHQ.getMekHQOptions().getUncrewedBackground());
} else {
setForeground(UIManager.getColor("Table.foreground"));
setBackground(UIManager.getColor("Table.background"));
@@ -311,11 +318,6 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
}
return this;
}
-
- private void applyColors(ColorPreference c) {
- setBackground(c.getColor().orElseGet(() -> UIManager.getColor("Table.background")));
- setForeground(c.getAlternateColor().orElseGet(() -> UIManager.getColor("Table.foreground")));
- }
}
public class VisualRenderer extends BasicInfo implements TableCellRenderer {
diff --git a/MekHQ/src/mekhq/gui/preferences/ColorPreference.java b/MekHQ/src/mekhq/gui/preferences/ColorPreference.java
deleted file mode 100644
index f02b1549ce..0000000000
--- a/MekHQ/src/mekhq/gui/preferences/ColorPreference.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2020 The MegaMek Team. All rights reserved.
- *
- * This file is part of MekHQ.
- *
- * MekHQ is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MekHQ is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MekHQ. If not, see .
- */
-package mekhq.gui.preferences;
-
-import java.awt.Color;
-import java.util.Optional;
-
-import megamek.common.annotations.Nullable;
-import megamek.client.ui.preferences.PreferenceElement;
-
-/**
- * Represents a preference which can manage a color and
- * an optional alternate color.
- */
-public class ColorPreference extends PreferenceElement {
-
- private final Color defaultColor;
- private final Color defaultAlternateColor;
- private Optional color = Optional.empty();
- private Optional alternateColor = Optional.empty();
-
- /**
- * Creates a new {@code ColorPreference} with a default {@link Color}.
- */
- public ColorPreference(String name, Color defaultColor) {
- super(name);
-
- this.defaultColor = defaultColor;
- this.defaultAlternateColor = null;
- }
-
- /**
- * Creates a new {@code ColorPreference} with a default {@link Color}
- * and a default alternate color.
- */
- public ColorPreference(String name, Color defaultColor, Color defaultAlternateColor) {
- super(name);
-
- this.defaultColor = defaultColor;
- this.defaultAlternateColor = defaultAlternateColor;
- }
-
- /**
- * Gets the main color.
- * @return The main color.
- */
- public Optional getColor() {
- return Optional.ofNullable(color.orElse(defaultColor));
- }
-
- /**
- * Sets the main color.
- * @param color The main color.
- */
- public void setColor(Optional color) {
- this.color = color;
- }
-
- /**
- * Gets the alternate color.
- * @return The alternate color.
- */
- public Optional getAlternateColor() {
- return Optional.ofNullable(alternateColor.orElse(defaultAlternateColor));
- }
-
- /**
- * Sets the alternate color.
- * @param alternateColor The alternate color.
- */
- public void setAlternateColor(Optional alternateColor) {
- this.alternateColor = alternateColor;
- }
-
- @Override
- protected String getValue() {
- if (alternateColor.isPresent()) {
- return String.format("%s|%s", format(color), format(alternateColor));
- } else {
- return format(color);
- }
- }
-
- @Nullable
- private static String format(Optional color) {
- return color.isPresent() ? "#" + Integer.toHexString(color.get().getRGB()) : null;
- }
-
- @Override
- protected void initialize(String value) {
- if (value != null) {
- String[] values = value.split("\\|");
- if (values.length > 0) {
- color = decode(values[0]);
- }
- if (values.length > 1) {
- alternateColor = decode(values[1]);
- }
- }
- }
-
- private static Optional decode(String value) {
- try {
- return Optional.ofNullable(Color.decode(value));
- } catch (NumberFormatException ex0) {
- try {
- return Optional.ofNullable(Color.getColor(value));
- } catch (NumberFormatException ex1) {
- // CAW: Ignored.
- }
- }
- return Optional.empty();
- }
-
- @Override
- protected void dispose() {
- }
-}
diff --git a/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java b/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java
index 6f9e4e599b..6c93d87a4f 100644
--- a/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java
+++ b/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java
@@ -44,13 +44,13 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableRowSorter;
+import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.againstTheBot.enums.AtBLanceRole;
import mekhq.campaign.force.Force;
import mekhq.campaign.force.Lance;
import mekhq.campaign.mission.AtBContract;
import mekhq.campaign.personnel.SkillType;
-import mekhq.gui.MekHqColors;
import mekhq.gui.model.DataTableModel;
import mekhq.gui.model.UnitMarketTableModel;
import mekhq.gui.model.XTableColumnModel;
@@ -67,7 +67,6 @@ public class LanceAssignmentView extends JPanel {
private static final long serialVersionUID = 7280552346074838142L;
private final Campaign campaign;
- private final MekHqColors colors = new MekHqColors();
private JTable tblRequiredLances;
private JTable tblAssignments;
@@ -114,7 +113,7 @@ public Component getTableCellRendererComponent(JTable table, Object value,
getAlignment(table.convertColumnIndexToModel(column)));
if (table.convertColumnIndexToModel(column) > RequiredLancesTableModel.COL_CONTRACT) {
if (((String) value).indexOf('/') >= 0) {
- colors.getBelowContractMinimum().getAlternateColor().ifPresent(this::setForeground);
+ setForeground(MekHQ.getMekHQOptions().getBelowContractMinimumForeground());
}
}
return this;