Cleanup and Bug Fixes
- Fixed a bug that left View menu items checked after the associated windows closed. - Cleaned up UI init code for several components.
This commit is contained in:
1 parent
933b09827a
commit
3636e78435
5 files changed
+67
-69
No files matched your search
@@ -45,11 +45,11 @@ public class MemoryWindow extends JFrame implements ActionListener {
|
||||
private JTable memoryTable;
|
||||
private JTextField pageNumberTextField;
|
||||
|
||||
private static final Dimension MINIMUM_SIZE = new Dimension(400, 450);
|
||||
private static final Dimension MINIMUM_SIZE = new Dimension(380, 580);
|
||||
|
||||
public MemoryWindow(Bus bus) {
|
||||
this.memoryTableModel = new MemoryTableModel(bus);
|
||||
this.createUi();
|
||||
createUi();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,8 @@ public class PreferencesDialog extends Observable implements Preferences {
|
||||
|
||||
public PreferencesDialog(Frame parent, boolean modal) {
|
||||
this.dialog = new JDialog(parent, modal);
|
||||
initComponents();
|
||||
|
||||
createUi();
|
||||
updateUi();
|
||||
}
|
||||
|
||||
@@ -59,7 +60,7 @@ public class PreferencesDialog extends Observable implements Preferences {
|
||||
/**
|
||||
* TODO: Validation of input.
|
||||
*/
|
||||
private void initComponents() {
|
||||
private void createUi() {
|
||||
dialog.setTitle("Preferences");
|
||||
Container contents = dialog.getContentPane();
|
||||
|
||||
|
||||
@@ -34,29 +34,29 @@ import java.awt.*;
|
||||
*/
|
||||
public class StatusPanel extends JPanel {
|
||||
|
||||
private final ImageIcon carryOn;
|
||||
private final ImageIcon carryOff;
|
||||
private final ImageIcon zeroOn;
|
||||
private final ImageIcon zeroOff;
|
||||
private final ImageIcon irqOn;
|
||||
private final ImageIcon irqOff;
|
||||
private final ImageIcon decimalOn;
|
||||
private final ImageIcon decimalOff;
|
||||
private final ImageIcon breakOn;
|
||||
private final ImageIcon breakOff;
|
||||
private final ImageIcon overflowOn;
|
||||
private final ImageIcon overflowOff;
|
||||
private final ImageIcon negativeOn;
|
||||
private final ImageIcon negativeOff;
|
||||
private ImageIcon carryOn;
|
||||
private ImageIcon carryOff;
|
||||
private ImageIcon zeroOn;
|
||||
private ImageIcon zeroOff;
|
||||
private ImageIcon irqOn;
|
||||
private ImageIcon irqOff;
|
||||
private ImageIcon decimalOn;
|
||||
private ImageIcon decimalOff;
|
||||
private ImageIcon breakOn;
|
||||
private ImageIcon breakOff;
|
||||
private ImageIcon overflowOn;
|
||||
private ImageIcon overflowOff;
|
||||
private ImageIcon negativeOn;
|
||||
private ImageIcon negativeOff;
|
||||
|
||||
private final JLabel statusFlagsLabel;
|
||||
private final JLabel carryFlagLabel;
|
||||
private final JLabel zeroFlagLabel;
|
||||
private final JLabel irqDisableFlagLabel;
|
||||
private final JLabel decimalModeFlagLabel;
|
||||
private final JLabel breakFlagLabel;
|
||||
private final JLabel overflowFlagLabel;
|
||||
private final JLabel negativeFlagLabel;
|
||||
private JLabel statusFlagsLabel;
|
||||
private JLabel carryFlagLabel;
|
||||
private JLabel zeroFlagLabel;
|
||||
private JLabel irqDisableFlagLabel;
|
||||
private JLabel decimalModeFlagLabel;
|
||||
private JLabel breakFlagLabel;
|
||||
private JLabel overflowFlagLabel;
|
||||
private JLabel negativeFlagLabel;
|
||||
|
||||
private JTextField opcodeField;
|
||||
private JTextField pcField;
|
||||
@@ -65,12 +65,12 @@ public class StatusPanel extends JPanel {
|
||||
private JTextField xField;
|
||||
private JTextField yField;
|
||||
|
||||
private final JLabel opcodeLabel;
|
||||
private final JLabel pcLabel;
|
||||
private final JLabel spLabel;
|
||||
private final JLabel aLabel;
|
||||
private final JLabel xLabel;
|
||||
private final JLabel yLabel;
|
||||
private JLabel opcodeLabel;
|
||||
private JLabel pcLabel;
|
||||
private JLabel spLabel;
|
||||
private JLabel aLabel;
|
||||
private JLabel xLabel;
|
||||
private JLabel yLabel;
|
||||
|
||||
private static final int EMPTY_BORDER = 10;
|
||||
private static final Border LABEL_BORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
|
||||
@@ -80,7 +80,10 @@ public class StatusPanel extends JPanel {
|
||||
|
||||
public StatusPanel() {
|
||||
super();
|
||||
createUi();
|
||||
}
|
||||
|
||||
private void createUi() {
|
||||
Border emptyBorder = BorderFactory.createEmptyBorder(EMPTY_BORDER, EMPTY_BORDER,
|
||||
EMPTY_BORDER, EMPTY_BORDER);
|
||||
Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
|
||||
|
||||
@@ -34,10 +34,9 @@ import java.awt.*;
|
||||
* This frame displays a trace of CPU execution. The most recent <code>TRACE_LENGTH</code> lines
|
||||
* are captured in a buffer and rendered to the JFrame's main text area upon request.
|
||||
*/
|
||||
public class TraceLog {
|
||||
public class TraceLog extends JFrame {
|
||||
|
||||
private FifoRingBuffer<Cpu.CpuState> traceLog;
|
||||
private JFrame traceLogFrame;
|
||||
private JTextArea traceLogTextArea;
|
||||
|
||||
private static final Dimension MIN_SIZE = new Dimension(320, 200);
|
||||
@@ -46,13 +45,12 @@ public class TraceLog {
|
||||
|
||||
public TraceLog() {
|
||||
traceLog = new FifoRingBuffer<Cpu.CpuState>(MAX_LOG_LENGTH);
|
||||
traceLogFrame = new JFrame();
|
||||
traceLogFrame.setMinimumSize(MIN_SIZE);
|
||||
traceLogFrame.setPreferredSize(PREFERRED_SIZE);
|
||||
traceLogFrame.setResizable(true);
|
||||
traceLogFrame.setTitle("Trace Log");
|
||||
setMinimumSize(MIN_SIZE);
|
||||
setPreferredSize(PREFERRED_SIZE);
|
||||
setResizable(true);
|
||||
setTitle("Trace Log");
|
||||
|
||||
traceLogFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
|
||||
traceLogTextArea = new JTextArea();
|
||||
traceLogTextArea.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12));
|
||||
@@ -60,9 +58,8 @@ public class TraceLog {
|
||||
|
||||
JScrollPane scrollableView = new JScrollPane(traceLogTextArea);
|
||||
|
||||
traceLogFrame.getContentPane().add(scrollableView);
|
||||
traceLogFrame.pack();
|
||||
// Don't show the frame. That action is controlled by the Simulator.
|
||||
getContentPane().add(scrollableView);
|
||||
pack();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,20 +107,4 @@ public class TraceLog {
|
||||
traceLogTextArea.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Trace Log window is currently visible.
|
||||
* @return ture if the Trace Log window is currently visible.
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
return traceLogFrame.isVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visibility of the Trace Log window.
|
||||
*
|
||||
* @param b True to make the Trace Log window visible, false to hide it.
|
||||
*/
|
||||
public void setVisible(boolean b) {
|
||||
traceLogFrame.setVisible(b);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user