diff --git a/application/src/main/java/net/emustudio/application/gui/schema/elements/Element.java b/application/src/main/java/net/emustudio/application/gui/schema/elements/Element.java
index 901a6afa9..4de162ad8 100644
--- a/application/src/main/java/net/emustudio/application/gui/schema/elements/Element.java
+++ b/application/src/main/java/net/emustudio/application/gui/schema/elements/Element.java
@@ -36,8 +36,8 @@ public abstract class Element {
final static int MOUSE_TOLERANCE = 5;
private final static int MIN_WIDTH = 80;
private final static int MIN_HEIGHT = 50;
- private final Font pluginNameFont = new Font(Font.DIALOG, Font.BOLD, 13);
- private final Font pluginTypeFont = new Font(Font.MONOSPACED, Font.ITALIC, 12);
+ private final static Font PLUGIN_NAME_FONT = new Font(Font.DIALOG, Font.BOLD, 13);
+ private final static Font PLUGIN_TYPE_FONT = new Font(Font.MONOSPACED, Font.ITALIC, 12);
private final Color backColor;
private final Color foreColor = new Color(0x909090);
@@ -101,12 +101,12 @@ public void draw(Graphics2D g) {
g.setColor(foreColor);
}
g.draw3DRect(leftX, topY, getWidth(), getHeight(), true);
- g.setFont(pluginNameFont);
+ g.setFont(PLUGIN_NAME_FONT);
if (!selected) {
g.setColor(Color.BLACK);
}
g.drawString(pluginName, textX, textY);
- g.setFont(pluginTypeFont);
+ g.setFont(PLUGIN_TYPE_FONT);
g.drawString(pluginType.name(), detailsX, detailsY);
}
@@ -144,9 +144,9 @@ public void setSize(int width, int height) {
*/
public void measure(Graphics g) {
// First measure width and height of text
- FontMetrics fm = g.getFontMetrics(pluginNameFont);
+ FontMetrics fm = g.getFontMetrics(PLUGIN_NAME_FONT);
Rectangle2D r = fm.getStringBounds(pluginName, g);
- FontMetrics fm1 = g.getFontMetrics(pluginTypeFont);
+ FontMetrics fm1 = g.getFontMetrics(PLUGIN_TYPE_FONT);
Rectangle2D r1 = fm1.getStringBounds(pluginType.name(), g);
int tW = (int) Math.max(r.getWidth(), r1.getWidth());
diff --git a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/Constants.java b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/Constants.java
index 9e495987d..f5428985c 100644
--- a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/Constants.java
+++ b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/Constants.java
@@ -21,14 +21,14 @@
import javax.swing.*;
import java.awt.*;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
import static net.emustudio.emulib.runtime.interaction.GuiUtils.loadIcon;
public class Constants {
- public final static Font MONOSPACED_PLAIN = new Font(Font.MONOSPACED, Font.PLAIN, 12);
- public final static Font DRIVE_BUTTON_FONT = new Font("Monospaced", Font.PLAIN, 14);
-
public final static String DIALOG_TITLE = "MITS 88-DCDD";
+ public final static Font DRIVE_BUTTON_FONT = FONT_MONOSPACED.deriveFont(14.0f);
+
public final static ImageIcon ICON_UNSELECTED = loadIcon("/net/emustudio/plugins/device/mits88dcdd/gui/unselected.png");
public final static ImageIcon ICON_SELECTED = loadIcon("/net/emustudio/plugins/device/mits88dcdd/gui/selected.png");
diff --git a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DiskGui.java b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DiskGui.java
index 34d5255a9..abe523c3a 100644
--- a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DiskGui.java
+++ b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DiskGui.java
@@ -29,8 +29,8 @@
import java.awt.event.KeyEvent;
import java.util.Objects;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
import static net.emustudio.plugins.device.mits88dcdd.gui.Constants.DIALOG_TITLE;
-import static net.emustudio.plugins.device.mits88dcdd.gui.Constants.MONOSPACED_PLAIN;
public class DiskGui extends JDialog {
private final DriveCollection drives;
@@ -74,7 +74,7 @@ public DiskGui(JFrame parent, DriveCollection drives) {
private static JLabel createMonospacedLabel(String text) {
JLabel label = new JLabel(text);
- label.setFont(MONOSPACED_PLAIN);
+ label.setFont(FONT_MONOSPACED);
return label;
}
@@ -216,7 +216,7 @@ private void initComponents() {
txtMountedImage.setEditable(false);
txtMountedImage.setBackground(UIManager.getDefaults().getColor("TextField.disabledBackground"));
txtMountedImage.setColumns(20);
- txtMountedImage.setFont(MONOSPACED_PLAIN);
+ txtMountedImage.setFont(FONT_MONOSPACED);
txtMountedImage.setLineWrap(true);
txtMountedImage.setRows(5);
jScrollPane1.setViewportView(txtMountedImage);
diff --git a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DriveButton.java b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DriveButton.java
index 885d69615..76dbbec85 100644
--- a/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DriveButton.java
+++ b/plugins/device/88-dcdd/src/main/java/net/emustudio/plugins/device/mits88dcdd/gui/DriveButton.java
@@ -20,14 +20,16 @@
import javax.swing.*;
-import static net.emustudio.plugins.device.mits88dcdd.gui.Constants.*;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
+import static net.emustudio.plugins.device.mits88dcdd.gui.Constants.ICON_SELECTED;
+import static net.emustudio.plugins.device.mits88dcdd.gui.Constants.ICON_UNSELECTED;
public class DriveButton extends JToggleButton {
public DriveButton(String text, Runnable action) {
super(text, ICON_UNSELECTED);
setToolTipText("Disk is unselected");
- setFont(MONOSPACED_PLAIN);
+ setFont(FONT_MONOSPACED);
setFocusPainted(false);
addActionListener(actionEvent -> action.run());
}
diff --git a/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/Constants.java b/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/Constants.java
deleted file mode 100644
index 18218367c..000000000
--- a/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/Constants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of emuStudio.
- *
- * Copyright (C) 2006-2023 Peter Jakubčo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.emustudio.plugins.device.mits88sio.gui;
-
-import java.awt.*;
-
-public class Constants {
- public static Font DIALOG_PLAIN = new Font(Font.DIALOG, Font.PLAIN, 12);
- public static Font MONOSPACED_PLAIN = new Font(Font.MONOSPACED, Font.PLAIN, 12);
- public static Font MONOSPACED_BOLD = new Font(Font.MONOSPACED, Font.BOLD, 12);
-}
diff --git a/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/SettingsDialog.java b/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/SettingsDialog.java
index 39cac5c69..f3082c9c8 100644
--- a/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/SettingsDialog.java
+++ b/plugins/device/88-sio/src/main/java/net/emustudio/plugins/device/mits88sio/gui/SettingsDialog.java
@@ -26,7 +26,7 @@
import java.awt.event.KeyEvent;
import java.util.Objects;
-import static net.emustudio.plugins.device.mits88sio.gui.Constants.MONOSPACED_PLAIN;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
public class SettingsDialog extends JDialog {
private final Dialogs dialogs;
@@ -56,6 +56,7 @@ public class SettingsDialog extends JDialog {
private final JList lstStatusPorts = new JList<>();
private final JSpinner spnInputInterrupt = new JSpinner(new SpinnerNumberModel(0, 0, 7, 1));
private final JSpinner spnOutputInterrupt = new JSpinner(new SpinnerNumberModel(0, 0, 7, 1));
+
public SettingsDialog(JFrame parent, SioUnitSettings settings, Dialogs dialogs) {
super(parent, true);
@@ -162,7 +163,7 @@ private void initComponents() {
panelStatusChannel.setBorder(BorderFactory.createTitledBorder("Status channel ports"));
- lstStatusPorts.setFont(MONOSPACED_PLAIN);
+ lstStatusPorts.setFont(FONT_MONOSPACED);
lstStatusPorts.setModel(statusPortsModel);
lstStatusPorts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
srlStatus.setViewportView(lstStatusPorts);
@@ -198,7 +199,7 @@ private void initComponents() {
panelDataChannel.setBorder(BorderFactory.createTitledBorder("Data channel ports"));
- lstDataPorts.setFont(MONOSPACED_PLAIN);
+ lstDataPorts.setFont(FONT_MONOSPACED);
lstDataPorts.setModel(dataPortsModel);
lstDataPorts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
srlData.setViewportView(lstDataPorts);
diff --git a/plugins/device/abstract-tape/src/main/java/net/emustudio/plugins/device/abstracttape/gui/TapeGui.java b/plugins/device/abstract-tape/src/main/java/net/emustudio/plugins/device/abstracttape/gui/TapeGui.java
index 79a2d5d98..a15c44319 100644
--- a/plugins/device/abstract-tape/src/main/java/net/emustudio/plugins/device/abstracttape/gui/TapeGui.java
+++ b/plugins/device/abstract-tape/src/main/java/net/emustudio/plugins/device/abstracttape/gui/TapeGui.java
@@ -23,14 +23,13 @@
import net.emustudio.plugins.device.abstracttape.api.TapeSymbol;
import javax.swing.*;
-import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.Objects;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
import static net.emustudio.emulib.runtime.interaction.GuiUtils.loadIcon;
public class TapeGui extends JDialog {
- public static final Font FONT_MONOSPACED = new Font(Font.MONOSPACED, Font.PLAIN, 12);
private static final String ICON_ADD_FIRST = "/net/emustudio/plugins/device/abstracttape/gui/go-up.png";
private static final String ICON_ADD_LAST = "/net/emustudio/plugins/device/abstracttape/gui/go-down.png";
diff --git a/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/Constants.java b/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/Constants.java
deleted file mode 100644
index 7cbf383d1..000000000
--- a/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/Constants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of emuStudio.
- *
- * Copyright (C) 2006-2023 Peter Jakubčo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.emustudio.plugins.memory.ram.gui;
-
-import java.awt.*;
-
-public class Constants {
- public static Font DIALOG_PLAIN = new Font(Font.DIALOG, Font.PLAIN, 12);
- public static Font MONOSPACED_PLAIN = new Font(Font.MONOSPACED, Font.PLAIN, 12);
-}
diff --git a/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/MemoryGui.java b/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/MemoryGui.java
index 8bf544868..078802f37 100644
--- a/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/MemoryGui.java
+++ b/plugins/memory/ram-mem/src/main/java/net/emustudio/plugins/memory/ram/gui/MemoryGui.java
@@ -29,8 +29,8 @@
import javax.swing.border.TitledBorder;
import java.awt.event.KeyEvent;
-import static net.emustudio.plugins.memory.ram.gui.Constants.DIALOG_PLAIN;
-import static net.emustudio.plugins.memory.ram.gui.Constants.MONOSPACED_PLAIN;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_COMMON;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
public class MemoryGui extends JDialog {
private final JTable table;
@@ -44,7 +44,7 @@ public MemoryGui(JFrame parent, MemoryContextImpl memory, Dialogs dialogs) {
RamTableModel tableModel = new RamTableModel(memory);
this.table = new JTable(tableModel);
- this.table.setFont(MONOSPACED_PLAIN);
+ this.table.setFont(FONT_MONOSPACED);
this.loadImageAction = new LoadImageAction(dialogs, memory, () -> {
table.revalidate();
@@ -74,7 +74,7 @@ private void initComponents() {
toolBar.addSeparator();
toolBar.add(new ToolbarButton(eraseMemoryAction));
- jPanel1.setBorder(BorderFactory.createTitledBorder(null, "Tape content", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, DIALOG_PLAIN));
+ jPanel1.setBorder(BorderFactory.createTitledBorder(null, "Tape content", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FONT_COMMON));
table.setGridColor(java.awt.SystemColor.control);
jScrollPane1.setViewportView(table);
diff --git a/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/Constants.java b/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/Constants.java
deleted file mode 100644
index 83c9c7fdd..000000000
--- a/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/Constants.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.emustudio.plugins.memory.rasp.gui;
-
-import java.awt.*;
-
-public class Constants {
- public static Font MONOSPACED_PLAIN = new Font(Font.MONOSPACED, Font.PLAIN, 12);
-}
diff --git a/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/MemoryGui.java b/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/MemoryGui.java
index 14e4d4b32..83453a787 100644
--- a/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/MemoryGui.java
+++ b/plugins/memory/rasp-mem/src/main/java/net/emustudio/plugins/memory/rasp/gui/MemoryGui.java
@@ -31,7 +31,7 @@
import java.awt.event.KeyEvent;
import java.util.Objects;
-import static net.emustudio.plugins.memory.rasp.gui.Constants.MONOSPACED_PLAIN;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
public class MemoryGui extends JDialog {
private final JTable table;
@@ -46,7 +46,7 @@ public MemoryGui(JFrame parent, MemoryContextImpl context, ApplicationApi api) {
MemoryContextImpl memory = Objects.requireNonNull(context);
RaspTableModel tableModel = new RaspTableModel(memory);
this.table = new JTable(tableModel);
- this.table.setFont(MONOSPACED_PLAIN);
+ this.table.setFont(FONT_MONOSPACED);
this.loadImageAction = new LoadImageAction(api.getDialogs(), context, () -> {
table.revalidate();
diff --git a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/Constants.java b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/Constants.java
index 461baba31..55af1d443 100644
--- a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/Constants.java
+++ b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/Constants.java
@@ -18,12 +18,7 @@
*/
package net.emustudio.plugins.memory.ssem.gui;
-import java.awt.*;
-
public final class Constants {
- public final static Font DEFAULT_FONT = new Font(Font.MONOSPACED, Font.PLAIN, 12);
- public final static Font BOLD_FONT = new Font(Font.MONOSPACED, Font.BOLD, 12);
-
public final static int CHAR_WIDTH = 17;
public final static int TWO_CHARS = 2 * CHAR_WIDTH;
diff --git a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryCellRenderer.java b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryCellRenderer.java
index e810038d8..98d76d9a9 100644
--- a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryCellRenderer.java
+++ b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryCellRenderer.java
@@ -23,7 +23,8 @@
import javax.swing.table.TableCellRenderer;
import java.awt.*;
-import static net.emustudio.plugins.memory.ssem.gui.Constants.*;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED_BOLD;
class MemoryCellRenderer extends JLabel implements TableCellRenderer {
private final static Color COLOR_FORE = Color.BLACK;
@@ -39,7 +40,7 @@ class MemoryCellRenderer extends JLabel implements TableCellRenderer {
setOpaque(true);
setDoubleBuffered(true);
setBorder(BorderFactory.createEmptyBorder());
- setFont(DEFAULT_FONT);
+ setFont(FONT_MONOSPACED);
setHorizontalAlignment(CENTER);
this.selectedBackground = UIManager.getColor("Table.selectionBackground");
@@ -75,10 +76,10 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
Color front = COLOR_FORE_UNIMPORTANT;
if (MemoryTableModel.isBitInstruction(column) || MemoryTableModel.isBitLine(column)) {
- setFont(BOLD_FONT);
+ setFont(FONT_MONOSPACED_BOLD);
front = COLOR_FORE;
} else {
- setFont(DEFAULT_FONT);
+ setFont(FONT_MONOSPACED);
}
if (MemoryTableModel.isBitLine(column)) {
diff --git a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryRowHeaderRenderer.java b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryRowHeaderRenderer.java
index 9ccee612f..1da8fa2e6 100644
--- a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryRowHeaderRenderer.java
+++ b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryRowHeaderRenderer.java
@@ -24,7 +24,7 @@
import javax.swing.table.JTableHeader;
import java.awt.*;
-import static net.emustudio.plugins.memory.ssem.gui.Constants.DEFAULT_FONT;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
class MemoryRowHeaderRenderer extends JLabel implements ListCellRenderer {
@@ -33,7 +33,7 @@ class MemoryRowHeaderRenderer extends JLabel implements ListCellRenderer
setHorizontalAlignment(CENTER);
setForeground(header.getForeground());
setBackground(header.getBackground());
- setFont(DEFAULT_FONT);
+ setFont(FONT_MONOSPACED);
setOpaque(true);
setDoubleBuffered(true);
this.setPreferredSize(new Dimension(4 * Constants.CHAR_WIDTH, header.getPreferredSize().height + 3));
diff --git a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryTable.java b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryTable.java
index 31bd936fa..69d69e7a8 100644
--- a/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryTable.java
+++ b/plugins/memory/ssem-mem/src/main/java/net/emustudio/plugins/memory/ssem/gui/table/MemoryTable.java
@@ -23,18 +23,18 @@
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
+import static net.emustudio.emulib.runtime.interaction.GuiConstants.FONT_MONOSPACED;
import static net.emustudio.plugins.memory.ssem.gui.Constants.COLUMN_WIDTH;
-import static net.emustudio.plugins.memory.ssem.gui.Constants.DEFAULT_FONT;
public class MemoryTable extends JTable {
public MemoryTable(MemoryTableModel tableModel, JScrollPane pm) {
setModel(tableModel);
- setFont(DEFAULT_FONT);
+ setFont(FONT_MONOSPACED);
setCellSelectionEnabled(true);
setFocusCycleRoot(true);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- getTableHeader().setFont(DEFAULT_FONT);
+ getTableHeader().setFont(FONT_MONOSPACED);
setDefaultRenderer(Object.class, new MemoryCellRenderer(getTableHeader(), tableModel, pm, getRowHeight()));
setOpaque(true);