Fix unit tests by "abstracting" getUITheme
This commit is contained in:
parent
58b9a2d499
commit
b7e007e1da
@ -117,6 +117,8 @@ public abstract class Preferences implements ChangeSource {
|
||||
public static final String LAUNCH_USE_ISA = "LaunchUseISA";
|
||||
public static final String SIMULATION_TIME_STEP = "SimulationTimeStep";
|
||||
public static final String GEODETIC_COMPUTATION = "GeodeticComputationStrategy";
|
||||
|
||||
public static final String UI_THEME = "UITheme";
|
||||
|
||||
|
||||
private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel();
|
||||
@ -974,6 +976,29 @@ public abstract class Preferences implements ChangeSource {
|
||||
public abstract void setComponentFavorite(ComponentPreset preset, ComponentPreset.Type type, boolean favorite);
|
||||
|
||||
public abstract Set<String> getComponentFavorites(ComponentPreset.Type type);
|
||||
|
||||
|
||||
/*
|
||||
NOTE: It is unusual for the UI Theme to be stored in the preferences instead of SwingPreferences. In fact, this code
|
||||
is not pretty. Sometimes I just really hate Java and circular dependencies...
|
||||
But the reason why this is implemented is because it would otherwise be an even bigger nightmare to fix unit tests
|
||||
that use their own preferences... Also wasn't a fan of always casting the preferences to SwingPreferences.
|
||||
*/
|
||||
/**
|
||||
* Get the current theme used for the UI.
|
||||
* @return the current theme
|
||||
*/
|
||||
public Object getUITheme() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the theme used for the UI.
|
||||
* @param theme the theme to set
|
||||
*/
|
||||
public void setUITheme(Object theme) {}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Within a holder class so they will load only when needed.
|
||||
|
@ -2,12 +2,10 @@ package net.sf.openrocket.communication;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.BuildProperties;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* This class handles assets extracted from a GitHub release page.
|
||||
|
@ -3,9 +3,7 @@ package net.sf.openrocket.database;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.openrocket.file.iterator.DirectoryIterator;
|
||||
import net.sf.openrocket.file.iterator.FileIterator;
|
||||
@ -14,7 +12,6 @@ import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.xml.OpenRocketComponentLoader;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.BugException;
|
||||
import net.sf.openrocket.util.Pair;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.sf.openrocket.gui.components;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
@ -11,15 +10,12 @@ import java.awt.Graphics2D;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BasicTree extends JTree {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public BasicTree() {
|
||||
super();
|
||||
setDefaultOptions();
|
||||
@ -41,7 +37,7 @@ public class BasicTree extends JTree {
|
||||
plainUI.setLeftChildIndent(15);
|
||||
|
||||
|
||||
this.setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
this.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
this.setShowsRootHandles(false);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
package net.sf.openrocket.gui.components;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.URLUtil;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@ -33,7 +32,6 @@ public class DescriptionArea extends JScrollPane {
|
||||
|
||||
private final JEditorPane editorPane;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
private final float size;
|
||||
|
||||
|
||||
@ -179,7 +177,7 @@ public class DescriptionArea extends JScrollPane {
|
||||
dim.height = lineheight * rows + extraheight + 2;
|
||||
this.setPreferredSize(dim);
|
||||
|
||||
editorPane.setBorder(prefs.getUITheme().getBorder());
|
||||
editorPane.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
|
||||
this.setViewportView(editorPane);
|
||||
this.setText(text);
|
||||
|
@ -1,25 +1,18 @@
|
||||
package net.sf.openrocket.gui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.URLUtil;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.sf.openrocket.util.BugException;
|
||||
|
||||
/**
|
||||
* A label of a URL that is clickable. Clicking the URL will launch the URL in
|
||||
* the default browser if the Desktop class is supported.
|
||||
@ -28,8 +21,7 @@ import net.sf.openrocket.util.BugException;
|
||||
*/
|
||||
public class URLLabel extends SelectableLabel {
|
||||
private static final Logger log = LoggerFactory.getLogger(URLLabel.class);
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
/**
|
||||
* Create a label showing the url it will direct to.
|
||||
*
|
||||
@ -56,7 +48,7 @@ public class URLLabel extends SelectableLabel {
|
||||
Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>();
|
||||
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
|
||||
this.setFont(this.getFont().deriveFont(map));
|
||||
this.setForeground(prefs.getUITheme().getURLColor());
|
||||
this.setForeground(GUIUtil.getUITheme().getURLColor());
|
||||
|
||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class Tester {
|
||||
BasicApplication baseApp = new BasicApplication();
|
||||
baseApp.initializeApplication();
|
||||
|
||||
GUIUtil.setLAF();
|
||||
GUIUtil.applyLAF();
|
||||
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||
import net.sf.openrocket.gui.components.BasicSlider;
|
||||
import net.sf.openrocket.gui.components.DescriptionArea;
|
||||
import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.material.Material;
|
||||
@ -399,8 +399,6 @@ class ClusterSelectionPanel extends JPanel {
|
||||
private static final int BUTTON_SIZE = 50;
|
||||
private static final int MOTOR_DIAMETER = 10;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
private static final Color SELECTED_COLOR;
|
||||
private static final Color UNSELECTED_COLOR;
|
||||
private static final Color MOTOR_FILL_COLOR;
|
||||
@ -408,7 +406,7 @@ class ClusterSelectionPanel extends JPanel {
|
||||
|
||||
static {
|
||||
SELECTED_COLOR = Color.RED;
|
||||
UNSELECTED_COLOR = prefs.getUITheme().getBackgroundColor();
|
||||
UNSELECTED_COLOR = GUIUtil.getUITheme().getBackgroundColor();
|
||||
MOTOR_FILL_COLOR = Color.GREEN;
|
||||
MOTOR_BORDER_COLOR = Color.BLACK;
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.dialogs.preset.ComponentPresetChooserDialog;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.widgets.IconToggleButton;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
@ -65,7 +64,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
private static final long serialVersionUID = -2925484062132243982L;
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
|
||||
private static final Preferences preferences = Application.getPreferences();
|
||||
|
||||
protected final OpenRocketDocument document;
|
||||
protected final RocketComponent component;
|
||||
@ -501,7 +500,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
StyledLabel labelMassOverriddenBy = new StyledLabel(
|
||||
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy"), component.getMassOverriddenBy().getName()),
|
||||
0, StyledLabel.Style.BOLD);
|
||||
labelMassOverriddenBy.setFontColor(preferences.getUITheme().getDarkWarningColor());
|
||||
labelMassOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
labelMassOverriddenBy.setToolTipText(
|
||||
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy.ttip"), component.getMassOverriddenBy().getName()));
|
||||
checkboxes.add(labelMassOverriddenBy, "gapleft 25lp, wrap");
|
||||
@ -564,7 +563,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
StyledLabel labelCGOverriddenBy = new StyledLabel(
|
||||
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy"), component.getCGOverriddenBy().getName()),
|
||||
0, StyledLabel.Style.BOLD);
|
||||
labelCGOverriddenBy.setFontColor(preferences.getUITheme().getDarkWarningColor());
|
||||
labelCGOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
labelCGOverriddenBy.setToolTipText(
|
||||
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy.ttip"), component.getCGOverriddenBy().getName()));
|
||||
checkboxes.add(labelCGOverriddenBy, "gapleft 25lp, wrap");
|
||||
@ -658,7 +657,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
StyledLabel labelCDOverriddenBy = new StyledLabel(
|
||||
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()),
|
||||
0, StyledLabel.Style.BOLD);
|
||||
labelCDOverriddenBy.setFontColor(preferences.getUITheme().getDarkWarningColor());
|
||||
labelCDOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
labelCDOverriddenBy.setToolTipText(
|
||||
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()));
|
||||
checkboxes.add(labelCDOverriddenBy, "gapleft 25lp, wrap");
|
||||
@ -714,7 +713,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
commentTextArea.setLineWrap(true);
|
||||
commentTextArea.setWrapStyleWord(true);
|
||||
commentTextArea.setEditable(true);
|
||||
commentTextArea.setBorder(preferences.getUITheme().getBorder());
|
||||
commentTextArea.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
GUIUtil.setTabToFocusing(commentTextArea);
|
||||
commentTextArea.addFocusListener(textFieldListener);
|
||||
commentTextArea.addKeyListener(new TextComponentSelectionKeyListener(commentTextArea));
|
||||
|
@ -20,7 +20,6 @@ import javax.swing.JTextArea;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
@ -28,8 +27,7 @@ import net.sf.openrocket.startup.Application;
|
||||
|
||||
public class RocketConfig extends RocketComponentConfig {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private TextFieldListener textFieldListener;
|
||||
|
||||
private JTextArea designerTextArea;
|
||||
@ -57,7 +55,7 @@ public class RocketConfig extends RocketComponentConfig {
|
||||
designerTextArea.setLineWrap(true);
|
||||
designerTextArea.setWrapStyleWord(true);
|
||||
designerTextArea.setEditable(true);
|
||||
designerTextArea.setBorder(prefs.getUITheme().getBorder());
|
||||
designerTextArea.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
GUIUtil.setTabToFocusing(designerTextArea);
|
||||
designerTextArea.addFocusListener(textFieldListener);
|
||||
this.add(new JScrollPane(designerTextArea), "wmin 400lp, height 60lp:60lp:, grow 30, wrap para");
|
||||
@ -72,7 +70,7 @@ public class RocketConfig extends RocketComponentConfig {
|
||||
revisionTextArea.setLineWrap(true);
|
||||
revisionTextArea.setWrapStyleWord(true);
|
||||
revisionTextArea.setEditable(true);
|
||||
revisionTextArea.setBorder(prefs.getUITheme().getBorder());
|
||||
revisionTextArea.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
GUIUtil.setTabToFocusing(revisionTextArea);
|
||||
revisionTextArea.addFocusListener(textFieldListener);
|
||||
|
||||
|
@ -17,6 +17,7 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -38,8 +39,7 @@ public class CustomExpressionPanel extends JPanel {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(CustomExpressionPanel.class);
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private JPanel expressionSelectorPanel;
|
||||
private OpenRocketDocument doc;
|
||||
|
||||
@ -51,7 +51,7 @@ public class CustomExpressionPanel extends JPanel {
|
||||
expressionSelectorPanel.setToolTipText(trans.get("customExpressionPanel.lbl.CalcNote"));
|
||||
|
||||
JScrollPane scroll = new JScrollPane(expressionSelectorPanel);
|
||||
expressionSelectorPanel.setBorder(prefs.getUITheme().getBorder());
|
||||
expressionSelectorPanel.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
|
||||
//Border bdr = BorderFactory.createTitledBorder(trans.get("customExpressionPanel.lbl.CustomExpressions"));
|
||||
//scroll.setBorder(bdr);
|
||||
@ -171,11 +171,10 @@ public class CustomExpressionPanel extends JPanel {
|
||||
* A JPanel which configures a single expression
|
||||
*/
|
||||
private class SingleExpression extends JPanel {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
// Convenience method to make the labels consistent
|
||||
private JLabel setLabelStyle(JLabel l) {
|
||||
l.setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
l.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
l.setOpaque(true);
|
||||
l.setBorder(BorderFactory.createRaisedBevelBorder());
|
||||
l.setText(" " + l.getText() + " ");
|
||||
@ -193,13 +192,13 @@ public class CustomExpressionPanel extends JPanel {
|
||||
JLabel symbolLabel = new JLabel(trans.get("customExpression.Symbol") + " :");
|
||||
JLabel symbol = new JLabel(expression.getSymbol());
|
||||
symbol = setLabelStyle(symbol);
|
||||
symbol.setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
symbol.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
|
||||
JLabel unitLabel = new JLabel(trans.get("customExpression.Units") + " :");
|
||||
UnitSelector unitSelector = new UnitSelector(expression.getType().getUnitGroup());
|
||||
//JLabel unitSelector = new JLabel ( expression.getUnit() );
|
||||
//unitSelector = setLabelStyle(unitSelector);
|
||||
//unitSelector.setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
//unitSelector.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
|
||||
JButton editButton = new SelectColorButton(Icons.EDIT_EDIT);
|
||||
editButton.setToolTipText(trans.get("customExpression.Units.but.ttip.Edit"));
|
||||
|
@ -178,7 +178,7 @@ public class BugReportDialog extends JDialog {
|
||||
private static void addBugReportInformation(StringBuilder sb) {
|
||||
sb.append("<html>---------- Bug report ----------\n");
|
||||
sb.append('\n');
|
||||
Color color = preferences.getUITheme().getDarkWarningColor();
|
||||
Color color = GUIUtil.getUITheme().getDarkWarningColor();
|
||||
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()));
|
||||
sb.append("<i>(You can edit text directly in this window)</i>\n");
|
||||
|
@ -41,7 +41,6 @@ import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.aerodynamics.AerodynamicCalculator;
|
||||
import net.sf.openrocket.aerodynamics.AerodynamicForces;
|
||||
import net.sf.openrocket.aerodynamics.FlightConditions;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.logging.WarningSet;
|
||||
import net.sf.openrocket.gui.adaptors.Column;
|
||||
@ -73,7 +72,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ComponentAnalysisDialog extends JDialog implements StateChangeListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(ComponentAnalysisDialog.class);
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
private static final long serialVersionUID = 9131240570600307935L;
|
||||
private static ComponentAnalysisDialog singletonDialog = null;
|
||||
@ -152,7 +150,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
|
||||
|
||||
warningList = new JList<>();
|
||||
JScrollPane scrollPane = new JScrollPane(warningList);
|
||||
warningList.setBorder(prefs.getUITheme().getBorder());
|
||||
warningList.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
////Warnings:
|
||||
scrollPane.setBorder(BorderFactory.createTitledBorder(trans.get("componentanalysisdlg.TitledBorder.warnings")));
|
||||
panel.add(scrollPane, "gap paragraph, spany 4, w 300lp, grow, height :100lp:, wrap");
|
||||
@ -649,7 +647,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
|
||||
}
|
||||
|
||||
label.setOpaque(true);
|
||||
label.setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
label.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
label.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
|
||||
if ((row < 0) || (row >= data.size()))
|
||||
@ -696,8 +694,6 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
|
||||
private class DragCellRenderer extends CustomCellRenderer {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public DragCellRenderer() {
|
||||
super(dragData, 3);
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableModel;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -68,8 +67,7 @@ public class DebugLogDialog extends JDialog {
|
||||
private static final int POLL_TIME = 250;
|
||||
private static final String STACK_TRACE_MARK = "\uFF01";
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private static final EnumMap<LogLevel, Color> backgroundColors = new EnumMap<LogLevel, Color>(LogLevel.class);
|
||||
static {
|
||||
for (LogLevel l : LogLevel.values()) {
|
||||
@ -345,7 +343,7 @@ public class DebugLogDialog extends JDialog {
|
||||
bottomPanel.add(new JLabel(trans.get("debuglogdlg.lbl.Stacktrace")), "wrap rel");
|
||||
stackTraceLabel = new JTextArea(8, 80);
|
||||
stackTraceLabel.setEditable(false);
|
||||
stackTraceLabel.setBorder(prefs.getUITheme().getBorder());
|
||||
stackTraceLabel.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
GUIUtil.changeFontSize(stackTraceLabel, -2);
|
||||
bottomPanel.add(new JScrollPane(stackTraceLabel), "grow, pushy 200, growprioy 200");
|
||||
|
||||
|
@ -3,14 +3,12 @@ package net.sf.openrocket.gui.dialogs;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.util.BetterListCellRenderer;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.logging.Error;
|
||||
import net.sf.openrocket.logging.ErrorSet;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.logging.WarningSet;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
@ -18,7 +16,6 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -28,13 +25,12 @@ import java.awt.event.MouseEvent;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class ErrorWarningDialog {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public static void showErrorsAndWarnings(Component parent, Object message, String title, ErrorSet errors, WarningSet warnings) {
|
||||
JPanel content = new JPanel(new MigLayout("ins 0, fillx"));
|
||||
|
||||
StyledLabel label = new StyledLabel("Errors");
|
||||
label.setFontColor(prefs.getUITheme().getDarkWarningColor());
|
||||
label.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
content.add(label, "wrap, gaptop 15lp");
|
||||
|
||||
Error[] e = errors.toArray(new Error[0]);
|
||||
@ -42,7 +38,7 @@ public abstract class ErrorWarningDialog {
|
||||
errorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
errorList.setCellRenderer(new ErrorListCellRenderer());
|
||||
JScrollPane errorPane = new JScrollPane(errorList);
|
||||
errorList.setBorder(prefs.getUITheme().getBorder());
|
||||
errorList.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
content.add(errorPane, "wrap, growx");
|
||||
|
||||
// Deselect items if clicked on blank region
|
||||
@ -64,7 +60,7 @@ public abstract class ErrorWarningDialog {
|
||||
final JList<Warning> warningList = new JList<>(w);
|
||||
warningList.setCellRenderer(new BetterListCellRenderer());
|
||||
JScrollPane warningPane = new JScrollPane(warningList);
|
||||
warningList.setBorder(prefs.getUITheme().getBorder());
|
||||
warningList.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
content.add(warningPane, "wrap, growx");
|
||||
|
||||
// Deselect items if clicked on blank region
|
||||
@ -91,9 +87,9 @@ public abstract class ErrorWarningDialog {
|
||||
|
||||
// Text color
|
||||
if (isSelected) {
|
||||
label.setForeground(prefs.getUITheme().getTextSelectionForegroundColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
|
||||
} else {
|
||||
label.setForeground(prefs.getUITheme().getDarkWarningColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
}
|
||||
|
||||
return label;
|
||||
|
@ -1,12 +1,10 @@
|
||||
package net.sf.openrocket.gui.dialogs;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -76,7 +74,7 @@ public class UpdateInfoDialog extends JDialog {
|
||||
|
||||
// Release information box
|
||||
final JTextPane textPane = new JTextPane();
|
||||
textPane.setBorder(BorderFactory.createLineBorder(preferences.getUITheme().getTextColor()));
|
||||
textPane.setBorder(BorderFactory.createLineBorder(GUIUtil.getUITheme().getTextColor()));
|
||||
textPane.setEditable(false);
|
||||
textPane.setContentType("text/html");
|
||||
textPane.setMargin(new Insets(10, 10, 40, 10));
|
||||
|
@ -8,22 +8,19 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import net.sf.openrocket.gui.util.BetterListCellRenderer;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.logging.WarningSet;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class WarningDialog {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public static void showWarnings(Component parent, Object message, String title, WarningSet warnings) {
|
||||
|
||||
Warning[] w = warnings.toArray(new Warning[0]);
|
||||
final JList<Warning> list = new JList<Warning>(w);
|
||||
list.setCellRenderer(new BetterListCellRenderer());
|
||||
JScrollPane pane = new JScrollPane(list);
|
||||
pane.setBorder(prefs.getUITheme().getBorder());
|
||||
pane.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
|
||||
JOptionPane.showMessageDialog(parent, new Object[] { message, pane },
|
||||
title, JOptionPane.WARNING_MESSAGE);
|
||||
|
@ -15,7 +15,6 @@ import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.configdialog.CommonStrings;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
@ -25,8 +24,7 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
public class RenameConfigDialog extends JDialog {
|
||||
private static final long serialVersionUID = -5423008694485357248L;
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
public RenameConfigDialog(final Window parent, final Rocket rocket, final FlightConfigurationId fcid) {
|
||||
super(parent, trans.get("RenameConfigDialog.title"), Dialog.ModalityType.APPLICATION_MODAL);
|
||||
|
||||
@ -74,7 +72,7 @@ public class RenameConfigDialog extends JDialog {
|
||||
+ trans.get("RenameConfigDialog.lbl.infoManufacturers")
|
||||
+ trans.get("RenameConfigDialog.lbl.infoCombination");
|
||||
StyledLabel info = new StyledLabel(text, -2);
|
||||
info.setFontColor(prefs.getUITheme().getDimTextColor());
|
||||
info.setFontColor(GUIUtil.getUITheme().getDimTextColor());
|
||||
panel.add(info, "spanx, growx, wrap");
|
||||
|
||||
this.add(panel);
|
||||
|
@ -16,7 +16,6 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.util.StringUtils;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
@ -39,13 +38,12 @@ import net.sf.openrocket.unit.UnitGroup;
|
||||
@SuppressWarnings("serial")
|
||||
class MotorInformationPanel extends JPanel {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private static final int ZOOM_ICON_POSITION_NEGATIVE_X = 50;
|
||||
private static final int ZOOM_ICON_POSITION_POSITIVE_Y = 12;
|
||||
|
||||
private static final Color NO_COMMENT_COLOR = prefs.getUITheme().getDimTextColor();
|
||||
private static final Color WITH_COMMENT_COLOR = prefs.getUITheme().getTextColor();
|
||||
private static final Color NO_COMMENT_COLOR = GUIUtil.getUITheme().getDimTextColor();
|
||||
private static final Color WITH_COMMENT_COLOR = GUIUtil.getUITheme().getTextColor();
|
||||
|
||||
// Motors in set
|
||||
private List<ThrustCurveMotor> selectedMotorSet;
|
||||
@ -192,7 +190,7 @@ class MotorInformationPanel extends JPanel {
|
||||
|
||||
//// Thrust curve:
|
||||
TextTitle title = new TextTitle(trans.get("TCMotorSelPan.title.Thrustcurve"), this.getFont());
|
||||
title.setPaint(prefs.getUITheme().getTextColor());
|
||||
title.setPaint(GUIUtil.getUITheme().getTextColor());
|
||||
chart.setTitle(title);
|
||||
chart.setBackgroundPaint(this.getBackground());
|
||||
plot.setBackgroundPaint(Color.WHITE);
|
||||
|
@ -16,7 +16,7 @@ import javax.swing.tree.TreePath;
|
||||
|
||||
import net.sf.openrocket.gui.components.BasicTree;
|
||||
import net.sf.openrocket.gui.main.ComponentIcons;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.optimization.rocketoptimization.SimulationModifier;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
@ -37,8 +37,7 @@ public class SimulationModifierTree extends BasicTree {
|
||||
|
||||
private final List<SimulationModifier> selectedModifiers;
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
/**
|
||||
* Sole constructor.
|
||||
*
|
||||
@ -158,7 +157,7 @@ public class SimulationModifierTree extends BasicTree {
|
||||
|
||||
// Set text color/style
|
||||
if (object instanceof RocketComponent) {
|
||||
setForeground(prefs.getUITheme().getDimTextColor());
|
||||
setForeground(GUIUtil.getUITheme().getDimTextColor());
|
||||
setFont(componentFont);
|
||||
|
||||
// Set tooltip
|
||||
@ -172,21 +171,21 @@ public class SimulationModifierTree extends BasicTree {
|
||||
this.setToolTipText(null);
|
||||
}
|
||||
} else if (object instanceof String) {
|
||||
setForeground(prefs.getUITheme().getDimTextColor());
|
||||
setForeground(GUIUtil.getUITheme().getDimTextColor());
|
||||
setFont(stringFont);
|
||||
} else if (object instanceof SimulationModifier) {
|
||||
|
||||
if (selectedModifiers.contains(object)) {
|
||||
setForeground(prefs.getUITheme().getDimTextColor());
|
||||
setForeground(GUIUtil.getUITheme().getDimTextColor());
|
||||
setFont(stringFont);
|
||||
} else {
|
||||
if (tree.getSelectionRows() != null &&
|
||||
IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) {
|
||||
setForeground(prefs.getUITheme().getTextSelectionForegroundColor());
|
||||
setBackground(prefs.getUITheme().getTextSelectionBackgroundColor());
|
||||
setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
|
||||
setBackground(GUIUtil.getUITheme().getTextSelectionBackgroundColor());
|
||||
setOpaque(true);
|
||||
} else {
|
||||
setForeground(prefs.getUITheme().getTextColor());
|
||||
setForeground(GUIUtil.getUITheme().getTextColor());
|
||||
}
|
||||
setFont(modifierFont);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
||||
this.add(new StyledLabel(trans.get("generalprefs.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap rel");
|
||||
|
||||
//// UI Theme
|
||||
UITheme.Theme currentTheme = preferences.getUITheme();
|
||||
UITheme.Theme currentTheme = GUIUtil.getUITheme();
|
||||
List<Named<UITheme.Theme>> themes = new ArrayList<>();
|
||||
for (UITheme.Theme t : UITheme.Themes.values()) {
|
||||
themes.add(new Named<>(t, t.getDisplayName()));
|
||||
@ -119,7 +119,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
||||
|
||||
//// You need to restart OpenRocket for the theme change to take effect.
|
||||
final JLabel lblRestartORTheme = new JLabel();
|
||||
lblRestartORTheme.setForeground(preferences.getUITheme().getDarkWarningColor());
|
||||
lblRestartORTheme.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
this.add(lblRestartORTheme, "spanx, wrap para*2, growx");
|
||||
|
||||
themesCombo.addActionListener(new ActionListener() {
|
||||
@ -129,7 +129,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
||||
Named<UITheme.Theme> selection = (Named<UITheme.Theme>) themesCombo.getSelectedItem();
|
||||
if (selection == null) return;
|
||||
UITheme.Theme t = selection.get();
|
||||
if (t == preferences.getUITheme()) {
|
||||
if (t == GUIUtil.getUITheme()) {
|
||||
lblRestartORTheme.setText("");
|
||||
return;
|
||||
}
|
||||
@ -231,8 +231,8 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
||||
|
||||
//// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
|
||||
DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -1.5f, false);
|
||||
desc.setBackground(preferences.getUITheme().getBackgroundColor());
|
||||
desc.setForeground(preferences.getUITheme().getTextColor());
|
||||
desc.setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
desc.setForeground(GUIUtil.getUITheme().getTextColor());
|
||||
this.add(desc, "spanx, growx, wrap 40lp");
|
||||
|
||||
|
||||
|
@ -23,16 +23,14 @@ import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||
import net.sf.openrocket.gui.components.BasicSlider;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.models.atmosphere.ExtendedISAModel;
|
||||
import net.sf.openrocket.simulation.SimulationOptions;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Chars;
|
||||
import net.sf.openrocket.util.StateChangeListener;
|
||||
|
||||
public class LaunchPreferencesPanel extends PreferencesPanel {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public LaunchPreferencesPanel(JDialog parent, LayoutManager layout) {
|
||||
super(parent, layout);
|
||||
@ -46,7 +44,7 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
|
||||
StyledLabel warning = new StyledLabel(String.format(
|
||||
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
|
||||
0.5f, StyledLabel.Style.BOLD);
|
||||
warning.setFontColor(prefs.getUITheme().getDarkWarningColor());
|
||||
warning.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
|
||||
add(warning, "spanx, growx 0, gapbottom para, wrap");
|
||||
|
||||
|
@ -17,9 +17,8 @@ import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||
import net.sf.openrocket.gui.components.BasicSlider;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.simulation.RK4SimulationStepper;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.GeodeticComputationStrategy;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
@ -27,8 +26,6 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
public class SimulationPreferencesPanel extends PreferencesPanel {
|
||||
private static final long serialVersionUID = 7983195730016979888L;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
/*
|
||||
* private GeodeticComputationStrategy geodeticComputation =
|
||||
* GeodeticComputationStrategy.SPHERICAL;
|
||||
@ -88,7 +85,7 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
|
||||
StyledLabel warning = new StyledLabel(String.format(
|
||||
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
|
||||
0, StyledLabel.Style.BOLD);
|
||||
warning.setFontColor(prefs.getUITheme().getDarkWarningColor());
|
||||
warning.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
|
||||
subsub.add(warning, "spanx, wrap para");
|
||||
|
||||
|
@ -34,7 +34,7 @@ import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -65,8 +65,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger log = LoggerFactory.getLogger(RocketFigure3d.class);
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
static {
|
||||
//this allows the GL canvas and things like the motor selection
|
||||
//drop down to z-order themselves.
|
||||
@ -290,7 +289,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
||||
GL2 gl = drawable.getGL().getGL2();
|
||||
GLU glu = new GLU();
|
||||
|
||||
Color backgroundColor = prefs.getUITheme().getBackgroundColor();
|
||||
Color backgroundColor = GUIUtil.getUITheme().getBackgroundColor();
|
||||
gl.glClearColor(backgroundColor.getRed()/255f, backgroundColor.getGreen()/255f,
|
||||
backgroundColor.getBlue()/255f, backgroundColor.getAlpha()/255f);
|
||||
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -373,7 +373,7 @@ public class PhotoFrame extends JFrame {
|
||||
|
||||
// Set the look-and-feel
|
||||
log.info("Setting LAF");
|
||||
GUIUtil.setLAF();
|
||||
GUIUtil.applyLAF();
|
||||
|
||||
// Load defaults
|
||||
((SwingPreferences) Application.getPreferences()).loadDefaultUnits();
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.sf.openrocket.gui.figureelements;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Area;
|
||||
@ -20,8 +19,6 @@ public class CGCaret extends Caret {
|
||||
|
||||
private static Area caret = null;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
/**
|
||||
* Create a new CGCaret at the specified coordinates.
|
||||
*/
|
||||
@ -61,7 +58,7 @@ public class CGCaret extends Caret {
|
||||
*/
|
||||
@Override
|
||||
protected Color getColor() {
|
||||
return prefs.getUITheme().getCGColor();
|
||||
return GUIUtil.getUITheme().getCGColor();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.sf.openrocket.gui.figureelements;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Area;
|
||||
@ -19,8 +18,6 @@ public class CPCaret extends Caret {
|
||||
|
||||
private static Area caret = null;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
/**
|
||||
* Create a new CPCaret at the specified coordinates.
|
||||
*/
|
||||
@ -56,6 +53,6 @@ public class CPCaret extends Caret {
|
||||
*/
|
||||
@Override
|
||||
protected Color getColor() {
|
||||
return prefs.getUITheme().getCPColor();
|
||||
return GUIUtil.getUITheme().getCPColor();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.awt.Rectangle;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.logging.WarningSet;
|
||||
@ -175,7 +176,7 @@ public class RocketInfo implements FigureElement {
|
||||
|
||||
GlyphVector massLineWithoutMotors = createText(massTextWithoutMotors);
|
||||
|
||||
g2.setColor(preferences.getUITheme().getTextColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getTextColor());
|
||||
|
||||
g2.drawGlyphVector(name, x1, y1);
|
||||
g2.drawGlyphVector(lengthLine, x1, y1+line);
|
||||
@ -231,7 +232,7 @@ public class RocketInfo implements FigureElement {
|
||||
// Add an extra space worth of width so the text doesn't run into the values
|
||||
unitWidth = unitWidth + spaceWidth;
|
||||
|
||||
g2.setColor(preferences.getUITheme().getTextColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getTextColor());
|
||||
|
||||
g2.drawGlyphVector(stabValue, (float)(x2-stabRect.getWidth()), y1);
|
||||
g2.drawGlyphVector(cgValue, (float)(x2-cgRect.getWidth()), y1+line);
|
||||
@ -254,7 +255,7 @@ public class RocketInfo implements FigureElement {
|
||||
atPos = (float)(x2 - atTextRect.getWidth());
|
||||
}
|
||||
|
||||
g2.setColor(preferences.getUITheme().getDimTextColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getDimTextColor());
|
||||
g2.drawGlyphVector(atText, atPos, y1 + 3*line);
|
||||
|
||||
}
|
||||
@ -404,7 +405,7 @@ public class RocketInfo implements FigureElement {
|
||||
|
||||
|
||||
float y = y2 - line * (texts.length-1);
|
||||
g2.setColor(preferences.getUITheme().getWarningColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getWarningColor());
|
||||
|
||||
for (GlyphVector v: texts) {
|
||||
Rectangle2D rect = v.getVisualBounds();
|
||||
@ -420,7 +421,7 @@ public class RocketInfo implements FigureElement {
|
||||
if (calculatingData) {
|
||||
//// Calculating...
|
||||
GlyphVector calculating = createText(trans.get("RocketInfo.Calculating"));
|
||||
g2.setColor(preferences.getUITheme().getTextColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getTextColor());
|
||||
g2.drawGlyphVector(calculating, x1, (float)(y2-height));
|
||||
}
|
||||
}
|
||||
@ -478,9 +479,9 @@ public class RocketInfo implements FigureElement {
|
||||
width += 5;
|
||||
|
||||
if (!calculatingData)
|
||||
g2.setColor(preferences.getUITheme().getFlightDataTextActiveColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFlightDataTextActiveColor());
|
||||
else
|
||||
g2.setColor(preferences.getUITheme().getFlightDataTextInactiveColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFlightDataTextInactiveColor());
|
||||
|
||||
g2.drawGlyphVector(apogee, (float)x1, (float)(y2-2*line));
|
||||
g2.drawGlyphVector(maxVelocity, (float)x1, (float)(y2-line));
|
||||
|
@ -12,8 +12,7 @@ import java.util.Map;
|
||||
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.util.BugException;
|
||||
|
||||
/**
|
||||
@ -23,8 +22,6 @@ import net.sf.openrocket.util.BugException;
|
||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public class SlideSetManager {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
private static final String TOURS_BASE_DIR = "datafiles/tours";
|
||||
|
||||
private static final String TOURS_FILE = "tours.txt";
|
||||
@ -135,7 +132,7 @@ public class SlideSetManager {
|
||||
try {
|
||||
|
||||
StyleSheet ss = new StyleSheet();
|
||||
Color textColor = prefs.getUITheme().getTextColor();
|
||||
Color textColor = GUIUtil.getUITheme().getTextColor();
|
||||
ss.addRule(String.format("p { color: rgb(%d, %d, %d, %d)",
|
||||
textColor.getRed(), textColor.getGreen(), textColor.getBlue(), textColor.getAlpha()));
|
||||
InputStreamReader reader = new InputStreamReader(in, "UTF-8");
|
||||
|
@ -12,8 +12,7 @@ import javax.swing.text.html.HTMLDocument;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
|
||||
import net.sf.openrocket.gui.components.ImageDisplayComponent;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
|
||||
/**
|
||||
* Component that displays a single slide, with the image on top and
|
||||
@ -31,8 +30,6 @@ public class SlideShowComponent extends JSplitPane {
|
||||
private final ImageDisplayComponent imageDisplay;
|
||||
private final JEditorPane textPane;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
public SlideShowComponent() {
|
||||
super(VERTICAL_SPLIT);
|
||||
@ -48,7 +45,7 @@ public class SlideShowComponent extends JSplitPane {
|
||||
textPane.setPreferredSize(new Dimension(WIDTH, HEIGHT_TEXT));
|
||||
|
||||
JScrollPane scrollPanel = new JScrollPane(textPane);
|
||||
textPane.setBorder(prefs.getUITheme().getBorder());
|
||||
textPane.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
this.setRightComponent(scrollPanel);
|
||||
|
||||
this.setResizeWeight(((double) HEIGHT_IMAGE) / (HEIGHT_IMAGE + HEIGHT_TEXT));
|
||||
|
@ -5,7 +5,6 @@ import net.sf.openrocket.document.OpenRocketDocument;
|
||||
import net.sf.openrocket.gui.configdialog.ComponentConfigDialog;
|
||||
import net.sf.openrocket.gui.main.componenttree.ComponentTree;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||
@ -50,7 +49,6 @@ import static net.sf.openrocket.gui.main.BasicFrame.SHORTCUT_KEY;
|
||||
*/
|
||||
public class DesignPanel extends JSplitPane {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
private final Component tree;
|
||||
|
||||
public DesignPanel(final BasicFrame parent, final OpenRocketDocument document, final ComponentTree tree) {
|
||||
@ -176,7 +174,7 @@ public class DesignPanel extends JSplitPane {
|
||||
|
||||
// Place tree inside scroll pane
|
||||
JScrollPane scroll = new JScrollPane(tree);
|
||||
tree.setBorder(prefs.getUITheme().getBorder());
|
||||
tree.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
panel.add(scroll, "spany, wmin 140px, grow, wrap");
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@ package net.sf.openrocket.gui.main.componenttree;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.util.List;
|
||||
@ -17,8 +16,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import net.sf.openrocket.gui.main.ComponentIcons;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.MassComponent;
|
||||
import net.sf.openrocket.rocketcomponent.MassComponent.MassComponentType;
|
||||
@ -32,7 +30,6 @@ import net.sf.openrocket.util.TextUtil;
|
||||
public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value,
|
||||
@ -83,12 +80,12 @@ public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
|
||||
// Set the background and foreground colors of the text JLabel
|
||||
if (sel) {
|
||||
textLabel.setOpaque(true);
|
||||
textLabel.setBackground(prefs.getUITheme().getTextSelectionBackgroundColor());
|
||||
textLabel.setForeground(prefs.getUITheme().getTextSelectionForegroundColor());
|
||||
textLabel.setBackground(GUIUtil.getUITheme().getTextSelectionBackgroundColor());
|
||||
textLabel.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
|
||||
} else {
|
||||
textLabel.setOpaque(true); // Set this to true to allow the background color to be visible
|
||||
textLabel.setBackground(prefs.getUITheme().getComponentTreeBackgroundColor());
|
||||
textLabel.setForeground(prefs.getUITheme().getComponentTreeForegroundColor());
|
||||
textLabel.setBackground(GUIUtil.getUITheme().getComponentTreeBackgroundColor());
|
||||
textLabel.setForeground(GUIUtil.getUITheme().getComponentTreeForegroundColor());
|
||||
}
|
||||
|
||||
comp = panel;
|
||||
@ -99,23 +96,23 @@ public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
|
||||
c.isCDOverridden() || c.getCDOverriddenBy() != null) {
|
||||
JPanel p = new JPanel();
|
||||
p.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
|
||||
p.setBackground(prefs.getUITheme().getComponentTreeBackgroundColor());
|
||||
p.setForeground(prefs.getUITheme().getComponentTreeForegroundColor());
|
||||
p.setBackground(GUIUtil.getUITheme().getComponentTreeBackgroundColor());
|
||||
p.setForeground(GUIUtil.getUITheme().getComponentTreeForegroundColor());
|
||||
p.add(comp/* , BorderLayout.WEST */);
|
||||
if (c.getMassOverriddenBy() != null) {
|
||||
p.add(new JLabel(prefs.getUITheme().getMassOverrideSubcomponentIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getMassOverrideSubcomponentIcon()));
|
||||
} else if (c.isMassOverridden()) {
|
||||
p.add(new JLabel(prefs.getUITheme().getMassOverrideIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getMassOverrideIcon()));
|
||||
}
|
||||
if (c.getCGOverriddenBy() != null) {
|
||||
p.add(new JLabel(prefs.getUITheme().getCGOverrideSubcomponentIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getCGOverrideSubcomponentIcon()));
|
||||
} else if (c.isCGOverridden()) {
|
||||
p.add(new JLabel(prefs.getUITheme().getCGOverrideIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getCGOverrideIcon()));
|
||||
}
|
||||
if (c.getCDOverriddenBy() != null) {
|
||||
p.add(new JLabel(prefs.getUITheme().getCDOverrideSubcomponentIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getCDOverrideSubcomponentIcon()));
|
||||
} else if (c.isCDOverridden()) {
|
||||
p.add(new JLabel(prefs.getUITheme().getCDOverrideIcon()));
|
||||
p.add(new JLabel(GUIUtil.getUITheme().getCDOverrideIcon()));
|
||||
}
|
||||
|
||||
// Make sure the tooltip also works on the override icons
|
||||
|
@ -390,12 +390,12 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
||||
|
||||
protected final void shaded(JLabel label) {
|
||||
GUIUtil.changeFontStyle(label, Font.ITALIC);
|
||||
label.setForeground(prefs.getUITheme().getDimTextColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getDimTextColor());
|
||||
}
|
||||
|
||||
protected final void regular(JLabel label) {
|
||||
GUIUtil.changeFontStyle(label, Font.PLAIN);
|
||||
label.setForeground(prefs.getUITheme().getTextColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getTextColor());
|
||||
}
|
||||
|
||||
protected abstract JLabel format( T component, FlightConfigurationId configId, JLabel label );
|
||||
|
@ -3,8 +3,6 @@ package net.sf.openrocket.gui.plot;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
@ -31,7 +29,6 @@ import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.simulation.FlightDataType;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.startup.Preferences;
|
||||
import net.sf.openrocket.util.Color;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
|
||||
import org.jfree.chart.ChartPanel;
|
||||
@ -45,8 +42,7 @@ import org.jfree.chart.JFreeChart;
|
||||
*/
|
||||
public class SimulationPlotDialog extends JDialog {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) {
|
||||
//// Flight data plot
|
||||
super(parent, simulation.getName());
|
||||
@ -77,7 +73,7 @@ public class SimulationPlotDialog extends JDialog {
|
||||
// Add warning if X axis type is not time
|
||||
if (config.getDomainAxisType() != FlightDataType.TYPE_TIME) {
|
||||
JLabel msg = new StyledLabel(trans.get("PlotDialog.lbl.timeSeriesWarning"), -2);
|
||||
msg.setForeground(prefs.getUITheme().getDarkWarningColor());
|
||||
msg.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
panel.add(msg, "wrap");
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,6 @@ import java.util.List;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -25,7 +23,6 @@ import net.sf.openrocket.util.StateChangeListener;
|
||||
public abstract class AbstractScaleFigure extends JPanel {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(AbstractScaleFigure.class);
|
||||
private final static SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public static final double INCHES_PER_METER = 39.3701;
|
||||
public static final double METERS_PER_INCH = 0.0254;
|
||||
@ -73,7 +70,7 @@ public abstract class AbstractScaleFigure extends JPanel {
|
||||
this.setPreferredSize(new Dimension(100,100));
|
||||
setSize(100,100);
|
||||
|
||||
setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
|
@ -14,13 +14,12 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.rocketcomponent.FreeformFinSet;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
||||
import net.sf.openrocket.rocketcomponent.Transition;
|
||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.Tick;
|
||||
import net.sf.openrocket.unit.Unit;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
@ -32,8 +31,6 @@ import net.sf.openrocket.util.StateChangeListener;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FinPointFigure extends AbstractScaleFigure {
|
||||
|
||||
private final static SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
private static final int GRID_LINE_BASE_WIDTH_PIXELS = 1;
|
||||
|
||||
@ -63,7 +60,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
public FinPointFigure(FreeformFinSet finset) {
|
||||
this.finset = finset;
|
||||
|
||||
setBackground(prefs.getUITheme().getBackgroundColor());
|
||||
setBackground(GUIUtil.getUITheme().getBackgroundColor());
|
||||
setOpaque(true);
|
||||
|
||||
updateFigure();
|
||||
@ -125,11 +122,11 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
Line2D.Double line = new Line2D.Double();
|
||||
for (Tick t : verticalTicks) {
|
||||
if (t.major) {
|
||||
g2.setColor(prefs.getUITheme().getFinPointGridMajorLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointGridMajorLineColor());
|
||||
line.setLine( t.value, y0, t.value, y1);
|
||||
g2.draw(line);
|
||||
}else{
|
||||
g2.setColor(prefs.getUITheme().getFinPointGridMinorLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointGridMinorLineColor());
|
||||
line.setLine( t.value, y0, t.value, y1);
|
||||
g2.draw(line);
|
||||
}
|
||||
@ -139,11 +136,11 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
Tick[] horizontalTicks = unit.getTicks(y0, y1, MINOR_TICKS / this.scale, MAJOR_TICKS / this.scale);
|
||||
for (Tick t : horizontalTicks) {
|
||||
if (t.major) {
|
||||
g2.setColor(prefs.getUITheme().getFinPointGridMajorLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointGridMajorLineColor());
|
||||
line.setLine( x0, t.value, x1, t.value);
|
||||
g2.draw(line);
|
||||
}else{
|
||||
g2.setColor(prefs.getUITheme().getFinPointGridMinorLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointGridMinorLineColor());
|
||||
line.setLine( x0, t.value, x1, t.value);
|
||||
g2.draw(line);
|
||||
}
|
||||
@ -166,7 +163,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
// setup lines
|
||||
final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale );
|
||||
g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
|
||||
g2.setColor(prefs.getUITheme().getFinPointBodyLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
|
||||
|
||||
Transition body = (Transition) finset.getParent();
|
||||
final float xResolution_m = 0.01f; // distance between draw points, in meters
|
||||
@ -216,7 +213,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
|
||||
final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale );
|
||||
g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
|
||||
g2.setColor(prefs.getUITheme().getFinPointBodyLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
|
||||
g2.draw(shape);
|
||||
}
|
||||
|
||||
@ -233,7 +230,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
|
||||
final float finEdgeWidth_m = (float) (LINE_WIDTH_FIN_PIXELS / scale );
|
||||
g2.setStroke(new BasicStroke( finEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
|
||||
g2.setColor(prefs.getUITheme().getFinPointBodyLineColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
|
||||
g2.draw(shape);
|
||||
}
|
||||
|
||||
@ -247,7 +244,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
|
||||
final float boxEdgeWidth_m = (float) ( LINE_WIDTH_BOX_PIXELS / scale );
|
||||
g2.setStroke(new BasicStroke( boxEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
|
||||
g2.setColor(prefs.getUITheme().getFinPointPointColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointPointColor());
|
||||
|
||||
finPointHandles = new Rectangle2D.Double[ drawPoints.length];
|
||||
for (int currentIndex = 0; currentIndex < drawPoints.length; currentIndex++) {
|
||||
@ -260,11 +257,11 @@ public class FinPointFigure extends AbstractScaleFigure {
|
||||
final Rectangle2D.Double selectedPointHighlight = new Rectangle2D.Double(c.x - selBoxHalfWidth, c.y - selBoxHalfWidth, selBoxWidth, selBoxWidth);
|
||||
|
||||
// switch to the highlight color
|
||||
g2.setColor(prefs.getUITheme().getFinPointSelectedPointColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointSelectedPointColor());
|
||||
g2.draw(selectedPointHighlight);
|
||||
|
||||
// reset to the normal color
|
||||
g2.setColor(prefs.getUITheme().getFinPointPointColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getFinPointPointColor());
|
||||
}
|
||||
|
||||
// normal boxes
|
||||
|
@ -17,6 +17,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||
import net.sf.openrocket.rocketcomponent.ParallelStage;
|
||||
import net.sf.openrocket.rocketcomponent.PodSet;
|
||||
@ -290,8 +291,8 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
|
||||
// Draw motors
|
||||
Color fillColor = ((SwingPreferences)Application.getPreferences()).getUITheme().getMotorFillColor();
|
||||
Color borderColor = ((SwingPreferences)Application.getPreferences()).getUITheme().getMotorBorderColor();
|
||||
Color fillColor = GUIUtil.getUITheme().getMotorFillColor();
|
||||
Color borderColor = GUIUtil.getUITheme().getMotorBorderColor();
|
||||
|
||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||
for (MotorConfiguration curInstance : config.getActiveMotors()) {
|
||||
|
@ -25,8 +25,7 @@ import javax.swing.event.ChangeListener;
|
||||
|
||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||
import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.unit.Tick;
|
||||
import net.sf.openrocket.unit.Unit;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
@ -314,8 +313,6 @@ public class ScaleScrollPane extends JScrollPane
|
||||
public static final int VERTICAL = 1;
|
||||
|
||||
private final int orientation;
|
||||
|
||||
private final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public Ruler(int orientation) {
|
||||
this.orientation = orientation;
|
||||
@ -402,7 +399,7 @@ public class ScaleScrollPane extends JScrollPane
|
||||
}
|
||||
|
||||
// Set color & hints
|
||||
g2.setColor(prefs.getUITheme().getTextColor());
|
||||
g2.setColor(GUIUtil.getUITheme().getTextColor());
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
|
@ -36,7 +36,6 @@ import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||
import net.sf.openrocket.gui.components.UnitSelector;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.simulation.RK4SimulationStepper;
|
||||
import net.sf.openrocket.simulation.SimulationOptions;
|
||||
@ -56,7 +55,6 @@ class SimulationOptionsPanel extends JPanel {
|
||||
private static final long serialVersionUID = -5251458539346201239L;
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
private OpenRocketDocument document;
|
||||
final Simulation simulation;
|
||||
@ -209,8 +207,8 @@ class SimulationOptionsPanel extends JPanel {
|
||||
|
||||
currentExtensions = new JPanel(new MigLayout("fillx, gap 0 0, ins 0"));
|
||||
JScrollPane scroll = new JScrollPane(currentExtensions);
|
||||
currentExtensions.setBorder(prefs.getUITheme().getBorder());
|
||||
scroll.setForeground(prefs.getUITheme().getTextColor());
|
||||
currentExtensions.setBorder(GUIUtil.getUITheme().getBorder());
|
||||
scroll.setForeground(GUIUtil.getUITheme().getTextColor());
|
||||
// &#$%! scroll pane will not honor "growy"...
|
||||
sub.add(scroll, "growx, growy, h 100%");
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class SimulationPlotPanel extends JPanel {
|
||||
//// The data will be plotted in time order even if the X axis type is not time.
|
||||
simPlotPanelDesc = new DescriptionArea("", 2, -2f, false);
|
||||
simPlotPanelDesc.setVisible(false);
|
||||
simPlotPanelDesc.setForeground(preferences.getUITheme().getDarkWarningColor());
|
||||
simPlotPanelDesc.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
simPlotPanelDesc.setViewportBorder(BorderFactory.createEmptyBorder());
|
||||
this.add(simPlotPanelDesc, "width 1px, growx 1, wrap unrel");
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
package net.sf.openrocket.gui.util;
|
||||
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
@ -14,7 +12,6 @@ import java.awt.Component;
|
||||
* @author Sibo Van Gool <sibo.vangool@hotmail.com>
|
||||
*/
|
||||
public class BetterListCellRenderer extends DefaultListCellRenderer {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
@ -24,16 +21,16 @@ public class BetterListCellRenderer extends DefaultListCellRenderer {
|
||||
// Alternating row colors
|
||||
if (!isSelected) {
|
||||
if (index % 2 == 0) {
|
||||
label.setBackground(prefs.getUITheme().getRowBackgroundDarkerColor());
|
||||
label.setBackground(GUIUtil.getUITheme().getRowBackgroundDarkerColor());
|
||||
} else {
|
||||
label.setBackground(prefs.getUITheme().getRowBackgroundLighterColor());
|
||||
label.setBackground(GUIUtil.getUITheme().getRowBackgroundLighterColor());
|
||||
}
|
||||
}
|
||||
// Text color
|
||||
if (isSelected) {
|
||||
label.setForeground(prefs.getUITheme().getTextSelectionForegroundColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
|
||||
} else {
|
||||
label.setForeground(prefs.getUITheme().getTextColor());
|
||||
label.setForeground(GUIUtil.getUITheme().getTextColor());
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ import net.sf.openrocket.arch.SystemInfo;
|
||||
import net.sf.openrocket.gui.Resettable;
|
||||
import net.sf.openrocket.logging.Markers;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.startup.Preferences;
|
||||
import net.sf.openrocket.util.BugException;
|
||||
import net.sf.openrocket.util.Invalidatable;
|
||||
import net.sf.openrocket.util.MemoryManagement;
|
||||
@ -79,8 +80,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class GUIUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(GUIUtil.class);
|
||||
private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
|
||||
private static final KeyStroke ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
private static final String CLOSE_ACTION_KEY = "escape:WINDOW_CLOSING";
|
||||
|
||||
@ -256,9 +256,22 @@ public class GUIUtil {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current theme used for the UI.
|
||||
* @return the current theme
|
||||
*/
|
||||
public static UITheme.Theme getUITheme() {
|
||||
Preferences prefs = Application.getPreferences();
|
||||
Object theme = prefs.getUITheme();
|
||||
if (theme instanceof UITheme.Theme) {
|
||||
return (UITheme.Theme) theme;
|
||||
}
|
||||
return UITheme.Themes.LIGHT;
|
||||
}
|
||||
|
||||
public static void setLAF() {
|
||||
UITheme.Theme theme = preferences.getUITheme();
|
||||
public static void applyLAF() {
|
||||
UITheme.Theme theme = getUITheme();
|
||||
theme.applyTheme();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
|
||||
public static final String NODE_WINDOWS = "windows";
|
||||
public static final String NODE_TABLES = "tables";
|
||||
private static final String UI_THEME = "UITheme";
|
||||
private static final String UI_FONT_SIZE = "UIFontSize";
|
||||
public static final String UPDATE_PLATFORM = "UpdatePlatform";
|
||||
|
||||
@ -114,16 +113,16 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
}
|
||||
|
||||
private void fillDefaultComponentColors() {
|
||||
DEFAULT_COLORS.put(BodyComponent.class, getUITheme().getDefaultBodyComponentColor());
|
||||
DEFAULT_COLORS.put(TubeFinSet.class, getUITheme().getDefaultTubeFinSetColor());
|
||||
DEFAULT_COLORS.put(FinSet.class, getUITheme().getDefaultFinSetColor());
|
||||
DEFAULT_COLORS.put(LaunchLug.class, getUITheme().getDefaultLaunchLugColor());
|
||||
DEFAULT_COLORS.put(RailButton.class, getUITheme().getDefaultRailButtonColor());
|
||||
DEFAULT_COLORS.put(InternalComponent.class, getUITheme().getDefaultInternalComponentColor());
|
||||
DEFAULT_COLORS.put(MassObject.class, getUITheme().getDefaultMassObjectColor());
|
||||
DEFAULT_COLORS.put(RecoveryDevice.class, getUITheme().getDefaultRecoveryDeviceColor());
|
||||
DEFAULT_COLORS.put(PodSet.class, getUITheme().getDefaultPodSetColor());
|
||||
DEFAULT_COLORS.put(ParallelStage.class, getUITheme().getDefaultParallelStageColor());
|
||||
DEFAULT_COLORS.put(BodyComponent.class, getUIThemeAsTheme().getDefaultBodyComponentColor());
|
||||
DEFAULT_COLORS.put(TubeFinSet.class, getUIThemeAsTheme().getDefaultTubeFinSetColor());
|
||||
DEFAULT_COLORS.put(FinSet.class, getUIThemeAsTheme().getDefaultFinSetColor());
|
||||
DEFAULT_COLORS.put(LaunchLug.class, getUIThemeAsTheme().getDefaultLaunchLugColor());
|
||||
DEFAULT_COLORS.put(RailButton.class, getUIThemeAsTheme().getDefaultRailButtonColor());
|
||||
DEFAULT_COLORS.put(InternalComponent.class, getUIThemeAsTheme().getDefaultInternalComponentColor());
|
||||
DEFAULT_COLORS.put(MassObject.class, getUIThemeAsTheme().getDefaultMassObjectColor());
|
||||
DEFAULT_COLORS.put(RecoveryDevice.class, getUIThemeAsTheme().getDefaultRecoveryDeviceColor());
|
||||
DEFAULT_COLORS.put(PodSet.class, getUIThemeAsTheme().getDefaultPodSetColor());
|
||||
DEFAULT_COLORS.put(ParallelStage.class, getUIThemeAsTheme().getDefaultParallelStageColor());
|
||||
}
|
||||
|
||||
public String getNodename() {
|
||||
@ -332,8 +331,13 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
* Get the current theme used for the UI.
|
||||
* @return the current theme
|
||||
*/
|
||||
public UITheme.Theme getUITheme() {
|
||||
String theme = getString(UI_THEME, UITheme.Themes.LIGHT.name());
|
||||
@Override
|
||||
public Object getUITheme() {
|
||||
return getUIThemeAsTheme();
|
||||
}
|
||||
|
||||
private UITheme.Theme getUIThemeAsTheme() {
|
||||
String theme = getString(net.sf.openrocket.startup.Preferences.UI_THEME, UITheme.Themes.LIGHT.name());
|
||||
if (theme == null) return UITheme.Themes.LIGHT; // Default theme
|
||||
return UITheme.Themes.valueOf(theme);
|
||||
}
|
||||
@ -342,9 +346,10 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
* Set the theme used for the UI.
|
||||
* @param theme the theme to set
|
||||
*/
|
||||
public void setUITheme(UITheme.Theme theme) {
|
||||
if (theme == null) return;
|
||||
putString(UI_THEME, theme.name());
|
||||
@Override
|
||||
public void setUITheme(Object theme) {
|
||||
if (!(theme instanceof UITheme.Theme)) return;
|
||||
putString(net.sf.openrocket.startup.Preferences.UI_THEME, ((UITheme.Theme) theme).name());
|
||||
storeVersion();
|
||||
}
|
||||
|
||||
@ -382,13 +387,13 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
public net.sf.openrocket.util.Color getDefaultColor(Class<? extends RocketComponent> c) {
|
||||
String color = get("componentColors", c, DEFAULT_COLORS);
|
||||
if (color == null)
|
||||
return net.sf.openrocket.util.Color.fromAWTColor(getUITheme().getTextColor());
|
||||
return net.sf.openrocket.util.Color.fromAWTColor(getUIThemeAsTheme().getTextColor());
|
||||
|
||||
net.sf.openrocket.util.Color clr = parseColor(color);
|
||||
if (clr != null) {
|
||||
return clr;
|
||||
} else {
|
||||
return net.sf.openrocket.util.Color.fromAWTColor(getUITheme().getTextColor());
|
||||
return net.sf.openrocket.util.Color.fromAWTColor(getUIThemeAsTheme().getTextColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import com.github.weisj.darklaf.theme.DarculaTheme;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
@ -19,6 +21,7 @@ import java.util.Map;
|
||||
|
||||
public class UITheme {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final Logger log = LoggerFactory.getLogger(UITheme.class);
|
||||
|
||||
public interface Theme {
|
||||
void applyTheme();
|
||||
@ -299,7 +302,7 @@ public class UITheme {
|
||||
theme.apply(textArea);
|
||||
textArea.setCurrentLineHighlightColor(new Color(255, 255, 230));
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
log.warn("Unable to load RSyntaxTextArea theme", ioe);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -521,7 +524,7 @@ public class UITheme {
|
||||
"/org/fife/ui/rsyntaxtextarea/themes/dark.xml"));
|
||||
theme.apply(textArea);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
log.warn("Unable to load RSyntaxTextArea theme", ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package net.sf.openrocket.gui.widgets;
|
||||
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.UITheme;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
@ -11,12 +9,10 @@ import javax.swing.JButton;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
|
||||
public class SelectColorButton extends JButton {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public SelectColorButton() {
|
||||
addChangeListenerSelectColor();
|
||||
@ -43,7 +39,7 @@ public class SelectColorButton extends JButton {
|
||||
}
|
||||
|
||||
private void addChangeListenerSelectColor() {
|
||||
if ((prefs.getUITheme() != UITheme.Themes.LIGHT) ||
|
||||
if ((GUIUtil.getUITheme() != UITheme.Themes.LIGHT) ||
|
||||
(UIManager.getColor("Button.selectForeground") == null) ||
|
||||
(UIManager.getColor("Button.foreground") == null))
|
||||
return;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package net.sf.openrocket.gui.widgets;
|
||||
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.UITheme;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.Action;
|
||||
@ -18,7 +17,6 @@ import java.beans.PropertyChangeListener;
|
||||
* @author Sibo Van Gool <sibo.vangool@hotmail.com>
|
||||
*/
|
||||
public class SelectColorToggleButton extends JToggleButton {
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public SelectColorToggleButton(Action a) {
|
||||
super(a);
|
||||
@ -66,7 +64,7 @@ public class SelectColorToggleButton extends JToggleButton {
|
||||
* This is to fix an issue on OSX devices where the foreground color would be black on blue (hardly readable)
|
||||
*/
|
||||
private void addChangeListenerSelectColor() {
|
||||
if ((prefs.getUITheme() != UITheme.Themes.LIGHT) ||
|
||||
if ((GUIUtil.getUITheme() != UITheme.Themes.LIGHT) ||
|
||||
(UIManager.getColor("ToggleButton.selectForeground") == null) ||
|
||||
(UIManager.getColor("ToggleButton.foreground") == null))
|
||||
return;
|
||||
|
@ -9,12 +9,11 @@ import javax.swing.event.DocumentListener;
|
||||
|
||||
import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.plugin.Plugin;
|
||||
import net.sf.openrocket.simulation.extension.AbstractSwingSimulationExtensionConfigurator;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.Color;
|
||||
|
||||
@Plugin
|
||||
public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfigurator<JavaCode> {
|
||||
@ -23,7 +22,6 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
|
||||
private StyledLabel errorMsg;
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public JavaCodeConfigurator() {
|
||||
super(JavaCode.class);
|
||||
@ -37,7 +35,7 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
|
||||
classNameField = new JTextField(extension.getClassName());
|
||||
panel.add(classNameField, "growx, wrap");
|
||||
this.errorMsg = new StyledLabel();
|
||||
errorMsg.setFontColor(prefs.getUITheme().getDarkWarningColor());
|
||||
errorMsg.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
|
||||
errorMsg.setVisible(false);
|
||||
panel.add(errorMsg, "growx, wrap");
|
||||
|
||||
|
@ -19,12 +19,11 @@ import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.plugin.Plugin;
|
||||
import net.sf.openrocket.simulation.extension.AbstractSwingSimulationExtensionConfigurator;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
|
||||
@ -44,8 +43,6 @@ public class ScriptingConfigurator extends AbstractSwingSimulationExtensionConfi
|
||||
private ScriptingExtension extension;
|
||||
private Simulation simulation;
|
||||
|
||||
private static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
public ScriptingConfigurator() {
|
||||
super(ScriptingExtension.class);
|
||||
}
|
||||
@ -74,7 +71,7 @@ public class ScriptingConfigurator extends AbstractSwingSimulationExtensionConfi
|
||||
text.setLineWrap(true);
|
||||
text.setWrapStyleWord(true);
|
||||
text.setEditable(true);
|
||||
prefs.getUITheme().formatScriptTextArea(text);
|
||||
GUIUtil.getUITheme().formatScriptTextArea(text);
|
||||
text.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent event) {
|
||||
|
@ -200,7 +200,7 @@ public class SwingStartup {
|
||||
|
||||
// Set the look-and-feel
|
||||
log.info("Setting LAF");
|
||||
GUIUtil.setLAF();
|
||||
GUIUtil.applyLAF();
|
||||
|
||||
// Set tooltip delay time. Tooltips are used in MotorChooserDialog extensively.
|
||||
ToolTipManager.sharedInstance().setDismissDelay(30000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user