Refactor (dark) warning color to (dark) error color

This commit is contained in:
SiboVG 2024-02-16 01:02:35 +01:00
parent 90599bce02
commit 3d343528a5
12 changed files with 82 additions and 40 deletions

View File

@ -66,7 +66,7 @@ public class OBJOptionChooser extends JPanel {
private int totallyNormalCounter = 0; private int totallyNormalCounter = 0;
private static Color darkWarningColor; private static Color darkErrorColor;
static { static {
initColors(); initColors();
@ -319,7 +319,7 @@ public class OBJOptionChooser extends JPanel {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
/** /**
@ -328,7 +328,7 @@ public class OBJOptionChooser extends JPanel {
* @param loserButton The button to un-highlight * @param loserButton The button to un-highlight
*/ */
private void highlightButton(JButton highlightButton, JButton loserButton) { private void highlightButton(JButton highlightButton, JButton loserButton) {
highlightButton.setBorder(BorderFactory.createLineBorder(darkWarningColor)); highlightButton.setBorder(BorderFactory.createLineBorder(darkErrorColor));
loserButton.setBorder(UIManager.getBorder("Button.border")); loserButton.setBorder(UIManager.getBorder("Button.border"));
} }

View File

@ -99,7 +99,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva
private boolean allSameType; // Checks whether all listener components are of the same type as <component> private boolean allSameType; // Checks whether all listener components are of the same type as <component>
private boolean allMassive; // Checks whether all listener components, and this component, are massive private boolean allMassive; // Checks whether all listener components, and this component, are massive
private static Color darkWarningColor; private static Color darkErrorColor;
private static Color multiCompEditColor; private static Color multiCompEditColor;
private static Border border; private static Border border;
@ -205,7 +205,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor(); multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor();
border = GUIUtil.getUITheme().getBorder(); border = GUIUtil.getUITheme().getBorder();
} }
@ -539,7 +539,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva
StyledLabel labelMassOverriddenBy = new StyledLabel( StyledLabel labelMassOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy"), component.getMassOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy"), component.getMassOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelMassOverriddenBy.setFontColor(darkWarningColor); labelMassOverriddenBy.setFontColor(darkErrorColor);
labelMassOverriddenBy.setToolTipText( labelMassOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy.ttip"), component.getMassOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy.ttip"), component.getMassOverriddenBy().getName()));
checkboxes.add(labelMassOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelMassOverriddenBy, "gapleft 25lp, wrap");
@ -605,7 +605,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva
StyledLabel labelCGOverriddenBy = new StyledLabel( StyledLabel labelCGOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy"), component.getCGOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy"), component.getCGOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelCGOverriddenBy.setFontColor(darkWarningColor); labelCGOverriddenBy.setFontColor(darkErrorColor);
labelCGOverriddenBy.setToolTipText( labelCGOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy.ttip"), component.getCGOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy.ttip"), component.getCGOverriddenBy().getName()));
checkboxes.add(labelCGOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelCGOverriddenBy, "gapleft 25lp, wrap");
@ -702,7 +702,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva
StyledLabel labelCDOverriddenBy = new StyledLabel( StyledLabel labelCDOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelCDOverriddenBy.setFontColor(darkWarningColor); labelCDOverriddenBy.setFontColor(darkErrorColor);
labelCDOverriddenBy.setToolTipText( labelCDOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()));
checkboxes.add(labelCDOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelCDOverriddenBy, "gapleft 25lp, wrap");

View File

@ -49,7 +49,7 @@ public class BugReportDialog extends JDialog {
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences(); private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
private static Color darkWarningColor; private static Color darkErrorColor;
static { static {
initColors(); initColors();
@ -117,7 +117,7 @@ public class BugReportDialog extends JDialog {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
/** /**
@ -194,7 +194,7 @@ public class BugReportDialog extends JDialog {
private static void addBugReportInformation(StringBuilder sb) { private static void addBugReportInformation(StringBuilder sb) {
sb.append("<html>---------- Bug report ----------\n"); sb.append("<html>---------- Bug report ----------\n");
sb.append('\n'); sb.append('\n');
Color color = darkWarningColor; Color color = darkErrorColor;
sb.append(String.format("<b style='color:rgb(%d, %d, %d)'>Please include a description about what actions you were " + sb.append(String.format("<b style='color:rgb(%d, %d, %d)'>Please include a description about what actions you were " +
"performing when the exception occurred:</b>\n", color.getRed(), color.getGreen(), color.getBlue())); "performing when the exception occurred:</b>\n", color.getRed(), color.getGreen(), color.getBlue()));
sb.append("<i>(You can edit text directly in this window)</i>\n"); sb.append("<i>(You can edit text directly in this window)</i>\n");

View File

@ -29,7 +29,7 @@ import java.awt.event.MouseEvent;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class ErrorWarningDialog { public abstract class ErrorWarningDialog {
private static Border border; private static Border border;
private static Color darkWarningColor; private static Color darkErrorColor;
private static Color textSelectionForegroundColor; private static Color textSelectionForegroundColor;
static { static {
@ -43,7 +43,7 @@ public abstract class ErrorWarningDialog {
private static void updateColors() { private static void updateColors() {
border = GUIUtil.getUITheme().getBorder(); border = GUIUtil.getUITheme().getBorder();
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor(); textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor();
} }
@ -51,7 +51,7 @@ public abstract class ErrorWarningDialog {
JPanel content = new JPanel(new MigLayout("ins 0, fillx")); JPanel content = new JPanel(new MigLayout("ins 0, fillx"));
StyledLabel label = new StyledLabel("Errors"); StyledLabel label = new StyledLabel("Errors");
label.setFontColor(darkWarningColor); label.setFontColor(darkErrorColor);
content.add(label, "wrap, gaptop 15lp"); content.add(label, "wrap, gaptop 15lp");
Error[] e = errors.toArray(new Error[0]); Error[] e = errors.toArray(new Error[0]);
@ -110,7 +110,7 @@ public abstract class ErrorWarningDialog {
if (isSelected) { if (isSelected) {
label.setForeground(textSelectionForegroundColor); label.setForeground(textSelectionForegroundColor);
} else { } else {
label.setForeground(darkWarningColor); label.setForeground(darkErrorColor);
} }
return label; return label;

View File

@ -126,7 +126,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
//// You need to restart OpenRocket for the theme change to take effect. //// You need to restart OpenRocket for the theme change to take effect.
final JLabel lblRestartORTheme = new JLabel(); final JLabel lblRestartORTheme = new JLabel();
lblRestartORTheme.setForeground(GUIUtil.getUITheme().getDarkWarningColor()); lblRestartORTheme.setForeground(GUIUtil.getUITheme().getDarkErrorColor());
this.add(lblRestartORTheme, "spanx, wrap para*2, growx"); this.add(lblRestartORTheme, "spanx, wrap para*2, growx");
fontSizeSpinner.addChangeListener(new ChangeListener() { fontSizeSpinner.addChangeListener(new ChangeListener() {

View File

@ -11,7 +11,7 @@ import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.UITheme; import net.sf.openrocket.gui.util.UITheme;
public class LaunchPreferencesPanel extends PreferencesPanel { public class LaunchPreferencesPanel extends PreferencesPanel {
private static Color darkWarningColor; private static Color darkErrorColor;
static { static {
initColors(); initColors();
@ -29,7 +29,7 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
StyledLabel warning = new StyledLabel(String.format( StyledLabel warning = new StyledLabel(String.format(
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")), "<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
0.5f, StyledLabel.Style.BOLD); 0.5f, StyledLabel.Style.BOLD);
warning.setFontColor(darkWarningColor); warning.setFontColor(darkErrorColor);
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip")); warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
add(warning, "spanx, growx 0, gapbottom para, wrap"); add(warning, "spanx, growx 0, gapbottom para, wrap");
@ -44,7 +44,7 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
} }

View File

@ -28,7 +28,7 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
public class SimulationPreferencesPanel extends PreferencesPanel { public class SimulationPreferencesPanel extends PreferencesPanel {
private static final long serialVersionUID = 7983195730016979888L; private static final long serialVersionUID = 7983195730016979888L;
private static Color darkWarningColor; private static Color darkErrorColor;
static { static {
initColors(); initColors();
@ -93,7 +93,7 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
StyledLabel warning = new StyledLabel(String.format( StyledLabel warning = new StyledLabel(String.format(
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")), "<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
warning.setFontColor(darkWarningColor); warning.setFontColor(darkErrorColor);
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip")); warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
subsub.add(warning, "spanx, wrap para"); subsub.add(warning, "spanx, wrap para");
@ -309,6 +309,6 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
} }

View File

@ -69,7 +69,7 @@ public class RocketInfo implements FigureElement {
private static Color textColor; private static Color textColor;
private static Color dimTextColor; private static Color dimTextColor;
private static Color warningColor; private static Color darkErrorColor;
private static Color flightDataTextActiveColor; private static Color flightDataTextActiveColor;
private static Color flightDataTextInactiveColor; private static Color flightDataTextInactiveColor;
@ -91,7 +91,7 @@ public class RocketInfo implements FigureElement {
private static void updateColors() { private static void updateColors() {
textColor = GUIUtil.getUITheme().getTextColor(); textColor = GUIUtil.getUITheme().getTextColor();
dimTextColor = GUIUtil.getUITheme().getDimTextColor(); dimTextColor = GUIUtil.getUITheme().getDimTextColor();
warningColor = GUIUtil.getUITheme().getWarningColor(); darkErrorColor = GUIUtil.getUITheme().getErrorColor();
flightDataTextActiveColor = GUIUtil.getUITheme().getFlightDataTextActiveColor(); flightDataTextActiveColor = GUIUtil.getUITheme().getFlightDataTextActiveColor();
flightDataTextInactiveColor = GUIUtil.getUITheme().getFlightDataTextInactiveColor(); flightDataTextInactiveColor = GUIUtil.getUITheme().getFlightDataTextInactiveColor();
} }
@ -435,7 +435,7 @@ public class RocketInfo implements FigureElement {
float y = y2 - line * (texts.length-1); float y = y2 - line * (texts.length-1);
g2.setColor(warningColor); g2.setColor(darkErrorColor);
for (GlyphVector v: texts) { for (GlyphVector v: texts) {
Rectangle2D rect = v.getVisualBounds(); Rectangle2D rect = v.getVisualBounds();

View File

@ -45,7 +45,7 @@ import org.jfree.chart.JFreeChart;
public class SimulationPlotDialog extends JDialog { public class SimulationPlotDialog extends JDialog {
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private static Color darkWarningColor; private static Color darkErrorColor;
private final JCheckBox checkErrors; private final JCheckBox checkErrors;
static { static {
@ -82,7 +82,7 @@ public class SimulationPlotDialog extends JDialog {
// Add warning if X axis type is not time // Add warning if X axis type is not time
if (config.getDomainAxisType() != FlightDataType.TYPE_TIME) { if (config.getDomainAxisType() != FlightDataType.TYPE_TIME) {
JLabel msg = new StyledLabel(trans.get("PlotDialog.lbl.timeSeriesWarning"), -2); JLabel msg = new StyledLabel(trans.get("PlotDialog.lbl.timeSeriesWarning"), -2);
msg.setForeground(darkWarningColor); msg.setForeground(darkErrorColor);
panel.add(msg, "wrap"); panel.add(msg, "wrap");
} }
@ -207,7 +207,7 @@ public class SimulationPlotDialog extends JDialog {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
private boolean doPNGExport(ChartPanel chartPanel, JFreeChart chart){ private boolean doPNGExport(ChartPanel chartPanel, JFreeChart chart){

View File

@ -110,7 +110,7 @@ public class SimulationPlotPanel extends JPanel {
private DescriptionArea simPlotPanelDesc; private DescriptionArea simPlotPanelDesc;
private static java.awt.Color darkWarningColor; private static java.awt.Color darkErrorColor;
private static Border border; private static Border border;
static { static {
@ -213,7 +213,7 @@ public class SimulationPlotPanel extends JPanel {
//// The data will be plotted in time order even if the X axis type is not time. //// The data will be plotted in time order even if the X axis type is not time.
simPlotPanelDesc = new DescriptionArea("", 2, -2f, false); simPlotPanelDesc = new DescriptionArea("", 2, -2f, false);
simPlotPanelDesc.setVisible(false); simPlotPanelDesc.setVisible(false);
simPlotPanelDesc.setForeground(darkWarningColor); simPlotPanelDesc.setForeground(darkErrorColor);
simPlotPanelDesc.setViewportBorder(BorderFactory.createEmptyBorder()); simPlotPanelDesc.setViewportBorder(BorderFactory.createEmptyBorder());
this.add(simPlotPanelDesc, "width 1px, growx 1, wrap unrel"); this.add(simPlotPanelDesc, "width 1px, growx 1, wrap unrel");
@ -393,7 +393,7 @@ public class SimulationPlotPanel extends JPanel {
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
border = GUIUtil.getUITheme().getBorder(); border = GUIUtil.getUITheme().getBorder();
} }

View File

@ -41,8 +41,10 @@ public class UITheme {
Color getDisabledTextColor(); Color getDisabledTextColor();
Color getTextSelectionForegroundColor(); Color getTextSelectionForegroundColor();
Color getTextSelectionBackgroundColor(); Color getTextSelectionBackgroundColor();
Color getInformationColor();
Color getWarningColor(); Color getWarningColor();
Color getDarkWarningColor(); Color getErrorColor();
Color getDarkErrorColor();
Color getRowBackgroundLighterColor(); Color getRowBackgroundLighterColor();
Color getRowBackgroundDarkerColor(); Color getRowBackgroundDarkerColor();
Color getFlightDataTextActiveColor(); Color getFlightDataTextActiveColor();
@ -221,13 +223,23 @@ public class UITheme {
return UIManager.getColor("Tree.selectionBackground"); return UIManager.getColor("Tree.selectionBackground");
} }
@Override
public Color getInformationColor() {
return new Color(45, 45, 189);
}
@Override @Override
public Color getWarningColor() { public Color getWarningColor() {
return new Color(180, 90, 17);
}
@Override
public Color getErrorColor() {
return Color.RED; return Color.RED;
} }
@Override @Override
public Color getDarkWarningColor() { public Color getDarkErrorColor() {
return new Color(200,0,0); return new Color(200,0,0);
} }
@ -588,13 +600,23 @@ public class UITheme {
return new Color(75, 110, 175); return new Color(75, 110, 175);
} }
@Override
public Color getInformationColor() {
return new Color(208, 208, 255);
}
@Override @Override
public Color getWarningColor() { public Color getWarningColor() {
return new Color(255, 224, 166);
}
@Override
public Color getErrorColor() {
return new Color(246, 143, 143); return new Color(246, 143, 143);
} }
@Override @Override
public Color getDarkWarningColor() { public Color getDarkErrorColor() {
return new Color(229, 103, 103); return new Color(229, 103, 103);
} }
@ -952,13 +974,23 @@ public class UITheme {
return new Color(62, 108, 173); return new Color(62, 108, 173);
} }
@Override
public Color getInformationColor() {
return new Color(197, 197, 252);
}
@Override @Override
public Color getWarningColor() { public Color getWarningColor() {
return new Color(255, 233, 187);
}
@Override
public Color getErrorColor() {
return new Color(255, 173, 173); return new Color(255, 173, 173);
} }
@Override @Override
public Color getDarkWarningColor() { public Color getDarkErrorColor() {
return new Color(255, 178, 178); return new Color(255, 178, 178);
} }
@ -1328,14 +1360,24 @@ public class UITheme {
return getCurrentTheme().getTextSelectionBackgroundColor(); return getCurrentTheme().getTextSelectionBackgroundColor();
} }
@Override
public Color getInformationColor() {
return getCurrentTheme().getInformationColor();
}
@Override @Override
public Color getWarningColor() { public Color getWarningColor() {
return getCurrentTheme().getWarningColor(); return getCurrentTheme().getWarningColor();
} }
@Override @Override
public Color getDarkWarningColor() { public Color getErrorColor() {
return getCurrentTheme().getDarkWarningColor(); return getCurrentTheme().getErrorColor();
}
@Override
public Color getDarkErrorColor() {
return getCurrentTheme().getDarkErrorColor();
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private static Color darkWarningColor; private static Color darkErrorColor;
static { static {
initColors(); initColors();
@ -42,7 +42,7 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
} }
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
} }
@Override @Override
@ -53,7 +53,7 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
classNameField = new JTextField(extension.getClassName()); classNameField = new JTextField(extension.getClassName());
panel.add(classNameField, "growx, wrap"); panel.add(classNameField, "growx, wrap");
this.errorMsg = new StyledLabel(); this.errorMsg = new StyledLabel();
errorMsg.setFontColor(darkWarningColor); errorMsg.setFontColor(darkErrorColor);
errorMsg.setVisible(false); errorMsg.setVisible(false);
panel.add(errorMsg, "growx, wrap"); panel.add(errorMsg, "growx, wrap");