use of apps.gui.GuiLafPreferencesManager in project JMRI by JMRI.
the class JUnitUtil method initGuiLafPreferencesManager.
public static void initGuiLafPreferencesManager() {
GuiLafPreferencesManager m = new GuiLafPreferencesManager();
InstanceManager.setDefault(GuiLafPreferencesManager.class, m);
}
use of apps.gui.GuiLafPreferencesManager in project JMRI by JMRI.
the class GuiLafConfigPane method doToolTipDismissDelay.
public void doToolTipDismissDelay(JPanel panel) {
GuiLafPreferencesManager manager = InstanceManager.getDefault(GuiLafPreferencesManager.class);
JLabel toolTipDismissDelayLabel = new JLabel(ConfigBundle.getMessage("GUIToolTipDismissDelay"));
toolTipDismissDelaySpinner = new JSpinner(new SpinnerNumberModel(manager.getToolTipDismissDelay() / 1000, MIN_TOOLTIP_TIME, MAX_TOOLTIP_TIME, 1));
this.toolTipDismissDelaySpinner.addChangeListener((ChangeEvent e) -> {
// convert to milliseconds from seconds
manager.setToolTipDismissDelay((int) toolTipDismissDelaySpinner.getValue() * 1000);
});
this.toolTipDismissDelaySpinner.setToolTipText(MessageFormat.format(ConfigBundle.getMessage("GUIToolTipDismissDelayToolTip"), MIN_TOOLTIP_TIME, MAX_TOOLTIP_TIME));
toolTipDismissDelayLabel.setToolTipText(this.toolTipDismissDelaySpinner.getToolTipText());
JLabel toolTipDismissDelayUoM = new JLabel(ConfigBundle.getMessage("GUIToolTipDismissDelayUoM"));
toolTipDismissDelayUoM.setToolTipText(this.toolTipDismissDelaySpinner.getToolTipText());
panel.add(toolTipDismissDelayLabel);
panel.add(toolTipDismissDelaySpinner);
panel.add(toolTipDismissDelayUoM);
}
use of apps.gui.GuiLafPreferencesManager in project JMRI by JMRI.
the class GuiLafConfigPane method doFontSize.
public void doFontSize(JPanel panel) {
GuiLafPreferencesManager manager = InstanceManager.getDefault(GuiLafPreferencesManager.class);
Integer[] sizes = new Integer[MAX_DISPLAYED_FONT_SIZE - MIN_DISPLAYED_FONT_SIZE + 1];
for (int i = 0; i < sizes.length; i++) {
sizes[i] = i + MIN_DISPLAYED_FONT_SIZE;
}
fontSizeComboBox = new JComboBox<>(sizes);
// allow users to set font sizes not listed
fontSizeComboBox.setEditable(true);
JLabel fontSizeLabel = new JLabel(ConfigBundle.getMessage("ConsoleFontSize"));
fontSizeComboBox.setSelectedItem(manager.getFontSize());
JLabel fontSizeUoM = new JLabel(ConfigBundle.getMessage("ConsoleFontSizeUoM"));
JButton resetButton = new JButton(ConfigBundle.getMessage("ResetDefault"));
resetButton.setToolTipText(ConfigBundle.getMessage("GUIFontSizeReset"));
panel.add(fontSizeLabel);
panel.add(fontSizeComboBox);
panel.add(fontSizeUoM);
panel.add(resetButton);
fontSizeComboBox.addActionListener((ActionEvent e) -> {
manager.setFontSize((int) fontSizeComboBox.getSelectedItem());
});
resetButton.addActionListener((ActionEvent e) -> {
if ((int) fontSizeComboBox.getSelectedItem() != manager.getDefaultFontSize()) {
fontSizeComboBox.setSelectedItem(manager.getDefaultFontSize());
}
});
}
use of apps.gui.GuiLafPreferencesManager in project JMRI by JMRI.
the class GuiLafConfigPaneXml method store.
/**
* Default implementation for storing the static contents of the Swing LAF
*
* @param o Object to store, of type GuiLafConfigPane
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
Element e = new Element("gui");
GuiLafConfigPane g = (GuiLafConfigPane) o;
String lafClassName = g.getClassName();
e.setAttribute("LAFclass", lafClassName);
e.setAttribute("class", this.getClass().getName());
Locale l = g.getLocale();
e.setAttribute("LocaleLanguage", l.getLanguage());
e.setAttribute("LocaleCountry", l.getCountry());
e.setAttribute("LocaleVariant", l.getVariant());
GuiLafPreferencesManager manager = InstanceManager.getDefault(GuiLafPreferencesManager.class);
if (manager.getFontSize() != manager.getDefaultFontSize()) {
e.setAttribute("fontsize", Integer.toString(manager.getFontSize()));
}
e.setAttribute("nonStandardMouseEvent", (g.mouseEvent.isSelected() ? "yes" : "no"));
e.setAttribute("graphicTableState", (g.graphicStateDisplay.isSelected() ? "yes" : "no"));
return e;
}
Aggregations