All things Swing have been officially removed from the codebase. Don't fret, a lot of these will be reborn with a new look very soon.

This commit is contained in:
Brendan Robert 2015-03-29 00:29:41 -05:00
parent 98fd203305
commit a52dafa8bb
27 changed files with 68 additions and 6150 deletions

View File

@ -20,9 +20,6 @@ package jace;
import jace.apple2e.Apple2e;
import jace.config.Configuration;
import jace.ui.AbstractEmulatorFrame;
import java.awt.Component;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -43,7 +40,6 @@ public class Emulator {
// }
public static Apple2e computer;
public AbstractEmulatorFrame theApp;
/**
* Creates a new instance of Emulator
@ -51,6 +47,7 @@ public class Emulator {
*/
public Emulator(List<String> args) {
computer = new Apple2e();
Configuration.buildTree();
Configuration.loadSettings();
mainThread = Thread.currentThread();
Map<String, String> settings = new LinkedHashMap<>();
@ -75,77 +72,7 @@ public class Emulator {
}
}
Configuration.applySettings(settings);
// theApp = new MainFrame();
// theApp = new EmulatorFrame(computer);
// try {
// theApp.setIconImage(ImageIO.read(Emulator.class.getClassLoader().getResourceAsStream("jace/data/woz_figure.gif")));
// } catch (IOException ex) {
// Logger.getLogger(Emulator.class.getName()).log(Level.SEVERE, null, ex);
// }
// //theApp.setBounds(new Rectangle((140*6),(192*3)));
// theApp.setVisible(true);
// theApp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// theApp.setFocusTraversalKeysEnabled(false);
// theApp.setTitle("Java Apple Computer Emulator");
// theApp.addKeyListener(computer.getKeyboard().getListener());
// theApp.addComponentListener(new ComponentListener() {
// // theApp.screen.addComponentListener(new ComponentListener() {
// @Override
// public void componentResized(ComponentEvent e) {
//// System.out.println("Screen resized");
// resizeVideo();
// }
//
// @Override
// public void componentMoved(ComponentEvent e) {
// resizeVideo();
// }
//
// @Override
// public void componentShown(ComponentEvent e) {
// }
//
// @Override
// public void componentHidden(ComponentEvent e) {
// }
// });
// theApp.addWindowListener(new WindowListener() {
// @Override
// public void windowOpened(WindowEvent e) {
// }
//
// @Override
// public void windowClosing(WindowEvent e) {
// }
//
// @Override
// public void windowClosed(WindowEvent e) {
// }
//
// @Override
// public void windowIconified(WindowEvent e) {
// computer.getVideo().suspend();
// }
//
// @Override
// public void windowDeiconified(WindowEvent e) {
// computer.getVideo().resume();
// resizeVideo();
// }
//
// @Override
// public void windowActivated(WindowEvent e) {
// resizeVideo();
// }
//
// @Override
// public void windowDeactivated(WindowEvent e) {
// resizeVideo();
// }
// });
EmulatorUILogic.registerDebugger();
// computer.getVideo().setScreen(theApp.getScreenGraphics());
// EmulatorUILogic.registerDebugger();
computer.coldStart();
}
@ -155,13 +82,4 @@ public class Emulator {
// window.resizeVideo();
// }
}
public static Component getScreen() {
return null;
// AbstractEmulatorFrame window = getFrame();
// if (window != null) {
// return window.getScreen();
// }
// return null;
}
}

View File

@ -30,7 +30,6 @@ import jace.core.RAM;
import jace.core.RAMEvent;
import jace.core.RAMListener;
import static jace.core.Utility.*;
import jace.ui.DebuggerPanel;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.image.BufferedImage;
@ -128,73 +127,73 @@ public class EmulatorUILogic implements Reconfigurable {
}
public static List<RAMListener> watches = new ArrayList<>();
public static void updateWatchList(final DebuggerPanel panel) {
java.awt.EventQueue.invokeLater(() -> {
watches.stream().forEach((oldWatch) -> {
Emulator.computer.getMemory().removeListener(oldWatch);
});
if (panel == null) {
return;
}
addWatch(panel.textW1, panel.valueW1);
addWatch(panel.textW2, panel.valueW2);
addWatch(panel.textW3, panel.valueW3);
addWatch(panel.textW4, panel.valueW4);
});
}
private static void addWatch(JTextField watch, final JLabel watchValue) {
final Integer address = getValidAddress(watch.getText());
if (address != null) {
//System.out.println("Adding watch for "+Integer.toString(address, 16));
RAMListener newListener = new RAMListener(RAMEvent.TYPE.WRITE, RAMEvent.SCOPE.ADDRESS, RAMEvent.VALUE.ANY) {
@Override
protected void doConfig() {
setScopeStart(address);
}
@Override
protected void doEvent(RAMEvent e) {
watchValue.setText(Integer.toHexString(e.getNewValue() & 0x0FF));
}
};
Emulator.computer.getMemory().addListener(newListener);
watches.add(newListener);
// Print out the current value right away
byte b = Emulator.computer.getMemory().readRaw(address);
watchValue.setText(Integer.toString(b & 0x0ff, 16));
} else {
watchValue.setText("00");
}
}
public static void updateBreakpointList(final DebuggerPanel panel) {
java.awt.EventQueue.invokeLater(() -> {
Integer address;
debugger.getBreakpoints().clear();
if (panel == null) {
return;
}
address = getValidAddress(panel.textBP1.getText());
if (address != null) {
debugger.getBreakpoints().add(address);
}
address = getValidAddress(panel.textBP2.getText());
if (address != null) {
debugger.getBreakpoints().add(address);
}
address = getValidAddress(panel.textBP3.getText());
if (address != null) {
debugger.getBreakpoints().add(address);
}
address = getValidAddress(panel.textBP4.getText());
if (address != null) {
debugger.getBreakpoints().add(address);
}
debugger.updateBreakpoints();
});
}
// public static void updateWatchList(final DebuggerPanel panel) {
// java.awt.EventQueue.invokeLater(() -> {
// watches.stream().forEach((oldWatch) -> {
// Emulator.computer.getMemory().removeListener(oldWatch);
// });
// if (panel == null) {
// return;
// }
// addWatch(panel.textW1, panel.valueW1);
// addWatch(panel.textW2, panel.valueW2);
// addWatch(panel.textW3, panel.valueW3);
// addWatch(panel.textW4, panel.valueW4);
// });
// }
//
// private static void addWatch(JTextField watch, final JLabel watchValue) {
// final Integer address = getValidAddress(watch.getText());
// if (address != null) {
// //System.out.println("Adding watch for "+Integer.toString(address, 16));
// RAMListener newListener = new RAMListener(RAMEvent.TYPE.WRITE, RAMEvent.SCOPE.ADDRESS, RAMEvent.VALUE.ANY) {
// @Override
// protected void doConfig() {
// setScopeStart(address);
// }
//
// @Override
// protected void doEvent(RAMEvent e) {
// watchValue.setText(Integer.toHexString(e.getNewValue() & 0x0FF));
// }
// };
// Emulator.computer.getMemory().addListener(newListener);
// watches.add(newListener);
// // Print out the current value right away
// byte b = Emulator.computer.getMemory().readRaw(address);
// watchValue.setText(Integer.toString(b & 0x0ff, 16));
// } else {
// watchValue.setText("00");
// }
// }
// public static void updateBreakpointList(final DebuggerPanel panel) {
// java.awt.EventQueue.invokeLater(() -> {
// Integer address;
// debugger.getBreakpoints().clear();
// if (panel == null) {
// return;
// }
// address = getValidAddress(panel.textBP1.getText());
// if (address != null) {
// debugger.getBreakpoints().add(address);
// }
// address = getValidAddress(panel.textBP2.getText());
// if (address != null) {
// debugger.getBreakpoints().add(address);
// }
// address = getValidAddress(panel.textBP3.getText());
// if (address != null) {
// debugger.getBreakpoints().add(address);
// }
// address = getValidAddress(panel.textBP4.getText());
// if (address != null) {
// debugger.getBreakpoints().add(address);
// }
// debugger.updateBreakpoints();
// });
// }
//
@InvokableAction(
name = "BRUN file",
category = "file",

View File

@ -1,295 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="mapType">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentResized"/>
<EventHandler event="componentShown" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentShown"/>
<EventHandler event="componentHidden" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/>
<EventHandler event="ancestorResized" listener="java.awt.event.HierarchyBoundsListener" parameters="java.awt.event.HierarchyEvent" handler="formAncestorResized"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="viewScroll" pref="633" max="32767" attributes="0"/>
<Component id="controlPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="viewScroll" pref="492" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="controlPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="viewScroll">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[640, 480]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="jace.cheat.MemorySpyGrid" name="memorySpyGrid">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[580, 480]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="646" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="490" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="controlPanel">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder roundedCorners="true"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="showLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="mapActivityMode" min="-2" max="-2" attributes="0"/>
<Component id="fastFadeCheckbox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="mapValueMode" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="zoomLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="useColorCheckbox" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="144" max="-2" attributes="0"/>
<Component id="endLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="zoomAmount" min="-2" pref="107" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="startLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="endAddress" pref="60" max="32767" attributes="0"/>
<Component id="startAddress" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="updateAddressButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="28" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="statusLabel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="zoomAmount" alignment="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="startLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="startAddress" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="endAddress" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="endLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="updateAddressButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="useColorCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fastFadeCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
<Component id="mapActivityMode" alignment="3" min="-2" pref="22" max="-2" attributes="0"/>
<Component id="showLabel" alignment="3" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="zoomLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="mapValueMode" alignment="3" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="showLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Show"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="zoomAmount">
<Properties>
<Property name="maximum" type="int" value="15"/>
<Property name="minimum" type="int" value="1"/>
<Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" type="boolean" value="true"/>
<Property name="value" type="int" value="5"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="zoomAmountStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="mapActivityMode">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="mapType"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Activity"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mapActivityModeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="mapValueMode">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="mapType"/>
</Property>
<Property name="text" type="java.lang.String" value="Value"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mapValueModeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="zoomLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Zoom"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="startAddress">
<Properties>
<Property name="text" type="java.lang.String" value="$0000"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="startLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="endAddress">
<Properties>
<Property name="text" type="java.lang.String" value="$FFFF"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Courier New" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder bevelType="0"/>
</Border>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="endLabel">
<Properties>
<Property name="text" type="java.lang.String" value="End"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="updateAddressButton">
<Properties>
<Property name="text" type="java.lang.String" value="Update"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="updateAddressButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="useColorCheckbox">
<Properties>
<Property name="text" type="java.lang.String" value="Color Gradient"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useColorCheckboxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="fastFadeCheckbox">
<Properties>
<Property name="text" type="java.lang.String" value="Fast Fade"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fastFadeCheckboxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,395 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.cheat;
import jace.core.Utility;
import static jace.core.Utility.gripe;
/**
* This represents the window of the memory spy module. The memory view itself
* is implemented in MemorySpyGrid.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class MemorySpy extends javax.swing.JFrame {
static MemorySpy singleton = null;
/**
* Creates new form MemorySpy
*/
public MemorySpy() {
initComponents();
setDefaultCloseOperation(HIDE_ON_CLOSE);
singleton = this;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mapType = new javax.swing.ButtonGroup();
viewScroll = new javax.swing.JScrollPane();
memorySpyGrid = new jace.cheat.MemorySpyGrid();
controlPanel = new javax.swing.JPanel();
showLabel = new javax.swing.JLabel();
zoomAmount = new javax.swing.JSlider();
mapActivityMode = new javax.swing.JRadioButton();
mapValueMode = new javax.swing.JRadioButton();
zoomLabel = new javax.swing.JLabel();
startAddress = new javax.swing.JTextField();
startLabel = new javax.swing.JLabel();
endAddress = new javax.swing.JTextField();
statusLabel = new javax.swing.JLabel();
endLabel = new javax.swing.JLabel();
updateAddressButton = new javax.swing.JButton();
useColorCheckbox = new javax.swing.JCheckBox();
fastFadeCheckbox = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
public void componentHidden(java.awt.event.ComponentEvent evt) {
formComponentHidden(evt);
}
});
addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
public void ancestorMoved(java.awt.event.HierarchyEvent evt) {
}
public void ancestorResized(java.awt.event.HierarchyEvent evt) {
formAncestorResized(evt);
}
});
viewScroll.setPreferredSize(new java.awt.Dimension(640, 480));
memorySpyGrid.setPreferredSize(new java.awt.Dimension(580, 480));
javax.swing.GroupLayout memorySpyGridLayout = new javax.swing.GroupLayout(memorySpyGrid);
memorySpyGrid.setLayout(memorySpyGridLayout);
memorySpyGridLayout.setHorizontalGroup(
memorySpyGridLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 631, Short.MAX_VALUE)
);
memorySpyGridLayout.setVerticalGroup(
memorySpyGridLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 490, Short.MAX_VALUE)
);
viewScroll.setViewportView(memorySpyGrid);
controlPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
showLabel.setText("Show");
zoomAmount.setMaximum(15);
zoomAmount.setMinimum(1);
zoomAmount.setPaintTicks(true);
zoomAmount.setSnapToTicks(true);
zoomAmount.setValue(5);
zoomAmount.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
zoomAmountStateChanged(evt);
}
});
mapType.add(mapActivityMode);
mapActivityMode.setSelected(true);
mapActivityMode.setText("Activity");
mapActivityMode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mapActivityModeActionPerformed(evt);
}
});
mapType.add(mapValueMode);
mapValueMode.setText("Value");
mapValueMode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mapValueModeActionPerformed(evt);
}
});
zoomLabel.setText("Zoom");
startAddress.setText("$0000");
startLabel.setText("Start");
endAddress.setText("$FFFF");
statusLabel.setFont(new java.awt.Font("Courier New", 0, 14)); // NOI18N
statusLabel.setText(" ");
statusLabel.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
endLabel.setText("End");
updateAddressButton.setText("Update");
updateAddressButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateAddressButtonActionPerformed(evt);
}
});
useColorCheckbox.setText("Color Gradient");
useColorCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
useColorCheckboxActionPerformed(evt);
}
});
fastFadeCheckbox.setText("Fast Fade");
fastFadeCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fastFadeCheckboxActionPerformed(evt);
}
});
javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel);
controlPanel.setLayout(controlPanelLayout);
controlPanelLayout.setHorizontalGroup(
controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(controlPanelLayout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(showLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mapActivityMode)
.addComponent(fastFadeCheckbox))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(controlPanelLayout.createSequentialGroup()
.addComponent(mapValueMode)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(zoomLabel))
.addComponent(useColorCheckbox))
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(controlPanelLayout.createSequentialGroup()
.addGap(144, 144, 144)
.addComponent(endLabel))
.addGroup(controlPanelLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(zoomAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(startLabel)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(endAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
.addComponent(startAddress))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(updateAddressButton)
.addContainerGap(28, Short.MAX_VALUE))
.addGroup(controlPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
controlPanelLayout.setVerticalGroup(
controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(controlPanelLayout.createSequentialGroup()
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(controlPanelLayout.createSequentialGroup()
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(zoomAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(startLabel)
.addComponent(startAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(endAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(endLabel)
.addComponent(updateAddressButton)
.addComponent(useColorCheckbox)
.addComponent(fastFadeCheckbox)))
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(mapActivityMode, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(showLabel))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(zoomLabel)
.addComponent(mapValueMode))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(statusLabel)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(viewScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 633, Short.MAX_VALUE)
.addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(viewScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(controlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mapActivityModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapActivityModeActionPerformed
memorySpyGrid.setDisplayMode(MemorySpyGrid.Modes.ACTIVITY);
}//GEN-LAST:event_mapActivityModeActionPerformed
private void mapValueModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapValueModeActionPerformed
memorySpyGrid.setDisplayMode(MemorySpyGrid.Modes.VALUE);
}//GEN-LAST:event_mapValueModeActionPerformed
private void zoomAmountStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomAmountStateChanged
if (!zoomAmount.getValueIsAdjusting()) {
memorySpyGrid.setZoomAmount(zoomAmount.getValue());
}
}//GEN-LAST:event_zoomAmountStateChanged
private void updateAddressButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateAddressButtonActionPerformed
int startAddr = Utility.parseHexInt(startAddress.getText());
int endAddr = Utility.parseHexInt(endAddress.getText());
if (startAddr < 0 || startAddr > 0x0ffff) {
gripe("Start address is out of range!");
return;
}
if (endAddr < 0 || endAddr > 0x0ffff) {
gripe("End address is out of range!");
return;
}
if (startAddr > endAddr) {
gripe("Start address must be smaller than end address");
return;
}
memorySpyGrid.updateRange(startAddr, endAddr);
}//GEN-LAST:event_updateAddressButtonActionPerformed
@Override
public void validate() {
super.validate();
memorySpyGrid.adjustSize();
}
private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden
memorySpyGrid.stopDisplay();
}//GEN-LAST:event_formComponentHidden
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
memorySpyGrid.startDisplay();
}//GEN-LAST:event_formComponentShown
long lastRefresh = -1L;
long refreshDelay = 1000L;
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
}//GEN-LAST:event_formComponentResized
private void formAncestorResized(java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_formAncestorResized
// java.awt.EventQueue.invokeLater(new Runnable() {
// @Override
// public void run() {
// lastRefresh = System.currentTimeMillis() + refreshDelay + 10;
// try {
// Thread.sleep(refreshDelay);
// } catch (InterruptedException ex) {
// Logger.getLogger(MemorySpy.class.getName()).log(Level.SEVERE, null, ex);
// }
// if (System.currentTimeMillis() >= lastRefresh) {
// int newWidth = getParent().getWidth();
// }
// }
// });
// memorySpyGrid.adjustSize();
}//GEN-LAST:event_formAncestorResized
private void useColorCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useColorCheckboxActionPerformed
memorySpyGrid.setColorGradient(useColorCheckbox.isSelected());
}//GEN-LAST:event_useColorCheckboxActionPerformed
private void fastFadeCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastFadeCheckboxActionPerformed
memorySpyGrid.setFastFade(fastFadeCheckbox.isSelected());
}//GEN-LAST:event_fastFadeCheckboxActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MemorySpy.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MemorySpy.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MemorySpy.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MemorySpy.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MemorySpy().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel controlPanel;
private javax.swing.JTextField endAddress;
private javax.swing.JLabel endLabel;
private javax.swing.JCheckBox fastFadeCheckbox;
private javax.swing.JRadioButton mapActivityMode;
private javax.swing.ButtonGroup mapType;
private javax.swing.JRadioButton mapValueMode;
private jace.cheat.MemorySpyGrid memorySpyGrid;
private javax.swing.JLabel showLabel;
private javax.swing.JTextField startAddress;
private javax.swing.JLabel startLabel;
public javax.swing.JLabel statusLabel;
private javax.swing.JButton updateAddressButton;
private javax.swing.JCheckBox useColorCheckbox;
private javax.swing.JScrollPane viewScroll;
private javax.swing.JSlider zoomAmount;
private javax.swing.JLabel zoomLabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="1" green="1" red="1" type="rgb"/>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Crosshair Cursor"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseClicked"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseExited"/>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseEntered"/>
<EventHandler event="mouseMoved" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="formMouseMoved"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -1,476 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.cheat;
import jace.Emulator;
import jace.core.RAM;
import jace.core.RAMEvent;
import jace.core.RAMEvent.TYPE;
import jace.core.RAMListener;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JViewport;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
* This is the memory view of the memory spy module. The window is defined by
* the MemorySpy class. This class registers memory listeners needed to provide
* the relevant memory views.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class MemorySpyGrid extends javax.swing.JPanel {
/**
* Creates new form MemorySpyGrid
*/
public MemorySpyGrid() {
initComponents();
gradient = bwGradient;
}
// This is used primarily during scroll events to repaint the whole area
ChangeListener viewportChangeListener = (ChangeEvent e) -> {
repaint();
};
@Override
public void validate() {
super.validate();
if (Emulator.computer != null) {
adjustSize();
}
if (getParent() != null) {
JViewport viewport = (JViewport) getParent();
viewport.removeChangeListener(viewportChangeListener);
viewport.addChangeListener(viewportChangeListener);
}
}
@Override
public void paint(Graphics g) {
super.paint(g);
if (mode == Modes.ACTIVITY) {
for (int a = startAddress; a <= endAddress; a++) {
if (!activeRam.contains(a)) {
drawActivity(a, 0, 0, 0, (Graphics2D) g);
} else {
drawActivity(a,
getInt(writeActivity.get(a)),
getInt(readActivity.get(a)),
getInt(pcActivity.get(a)),
(Graphics2D) g);
}
}
} else {
RAM ram = Emulator.computer.getMemory();
for (int a = startAddress; a <= endAddress; a++) {
drawValue(a, ram.readRaw(a) & 0x0ff, (Graphics2D) g);
}
}
}
Color[] gradient;
static Color[] colorGradient, bwGradient;
static {
colorGradient = new Color[256];
bwGradient = new Color[256];
for (int i = 0; i < 256; i++) {
float hue = ((float) i) / 360.0f;
colorGradient[i] = Color.getHSBColor(0.67f - hue, 1, 1);
bwGradient[i] = new Color(i, i, i);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setBackground(new java.awt.Color(1, 1, 1));
setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR));
addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
formMouseClicked(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
formMouseExited(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
formMouseEntered(evt);
}
});
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
formMouseMoved(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
boolean mousePresent = false;
int mouseX;
int mouseY;
private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
mouseX = evt.getX();
mouseY = evt.getY();
}//GEN-LAST:event_formMouseMoved
private void formMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseEntered
mousePresent = true;
}//GEN-LAST:event_formMouseEntered
private void formMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseExited
mousePresent = false;
}//GEN-LAST:event_formMouseExited
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
int addr = convertXYtoAddr(mouseX, mouseY);
if (addr >= 0) {
MetaCheats.singleton.addWatches(addr, addr);
}
}//GEN-LAST:event_formMouseClicked
private int convertXYtoAddr(int x, int y) {
int offset = x / zoomAmount;
if (offset < 0 || offset > columns) {
return -1;
}
int row = y / zoomAmount;
int addr = startAddress + (row * columns) + offset;
if (addr > endAddress) {
return -1;
}
return addr;
}
private String spaceFill(String s, int size) {
while (s.length() < size) {
s = s + " ";
}
return s;
}
private void updateDetails() {
final JLabel status = MemorySpy.singleton.statusLabel;
if (mousePresent) {
final int addr = convertXYtoAddr(mouseX, mouseY);
if (addr >= 0) {
final int value = Emulator.computer.getMemory().readRaw(addr) & 0x0ff;
java.awt.EventQueue.invokeLater(() -> {
Integer lastChange = setBy.get(addr);
Integer lastRead = readBy.get(addr);
char c1 = (char) Math.max(32, value & 0x07f);
char c2 = (char) (64 + (value % 32));
char c3 = (char) (32 + (value % 96));
status.setText("$"
+ spaceFill(Integer.toHexString(addr), 4) + ": "
+ spaceFill(String.valueOf(value), 3) + " ($"
+ spaceFill(Integer.toHexString(value), 2) + ") " + c1 + " " + c2 + " " + c3
+ (lastChange != null
? " Written by $"
+ spaceFill(Integer.toHexString(lastChange), 4)
: "")
+ (lastRead != null
? " Read by $"
+ spaceFill(Integer.toHexString(lastRead), 4)
: ""));
});
}
} else {
java.awt.EventQueue.invokeLater(() -> {
status.setText("Nothing selected");
});
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
Modes mode = Modes.ACTIVITY;
void setDisplayMode(Modes newMode) {
stopDisplay();
mode = newMode;
repaint();
startDisplay();
}
int zoomAmount = 5;
void setZoomAmount(int value) {
zoomAmount = value;
recalibrate();
}
int startAddress = 0;
int endAddress = 0x0ffff;
void updateRange(int startAddr, int endAddr) {
startAddress = startAddr;
endAddress = endAddr;
activeRam.clear();
valueActivity.clear();
readActivity.clear();
writeActivity.clear();
pcActivity.clear();
recalibrate();
}
int columns = 1;
int lastKnownWidth = 0;
int lastKnownHeight = 0;
public void adjustSize() {
int newWidth = getParent().getWidth();
if (newWidth == lastKnownWidth && getParent().getHeight() == lastKnownHeight) {
return;
}
lastKnownWidth = newWidth;
lastKnownHeight = getParent().getHeight();
recalibrate();
}
public void recalibrate() {
java.awt.EventQueue.invokeLater(() -> {
stopDisplay();
int size = endAddress - startAddress + 1;
int width1 = getParent().getWidth();
columns = ((width1 / zoomAmount) / 16) * 16;
int height1 = ((size / columns) + 1) * zoomAmount;
setSize(width1, height1);
setPreferredSize(new Dimension(width1, height1));
getParent().validate();
repaint();
startDisplay();
});
}
protected void drawValue(int addr, int value, Graphics2D g) {
int offset = addr - startAddress;
int x = zoomAmount * (offset % columns);
int y = zoomAmount * (offset / columns);
value = value & 0x0ff;
g.setColor(gradient[value]);
g.fillRect(x, y, zoomAmount, zoomAmount);
}
protected void drawActivity(int addr, int read, int write, int pc, Graphics2D g) {
int offset = addr - startAddress;
int x = zoomAmount * (offset % columns);
int y = zoomAmount * (offset / columns);
g.setColor(new Color(read & 0x0ff, write & 0x0ff, pc & 0x0ff));
g.fillRect(x, y, zoomAmount, zoomAmount);
}
private int getInt(Integer i) {
if (i != null) {
return i;
}
return 0;
}
boolean isDisplayActive = false;
Thread redrawThread = null;
// 30 fps or so
static int UPDATE_INTERVAL = 10;
static int ACTIVITY_INCREMENT = 150;
static int ACTIVITY_DECREMENT = 5;
static int ACTIVITY_MAX = 255;
RAMListener memoryListener = null;
Map<Integer, Integer> readActivity = new ConcurrentHashMap<>();
Map<Integer, Integer> writeActivity = new ConcurrentHashMap<>();
Map<Integer, Integer> pcActivity = new ConcurrentHashMap<>();
Set<Integer> activeRam = new ConcurrentSkipListSet<>();
Map<Integer, Integer> valueActivity = new ConcurrentHashMap<>();
Map<Integer, Integer> setBy = new ConcurrentHashMap<>();
Map<Integer, Integer> readBy = new ConcurrentHashMap<>();
void startDisplay() {
if (memoryListener != null) {
Emulator.computer.getMemory().removeListener(memoryListener);
memoryListener = null;
}
isDisplayActive = true;
memoryListener = new RAMListener(RAMEvent.TYPE.ANY, RAMEvent.SCOPE.RANGE, RAMEvent.VALUE.ANY) {
@Override
protected void doConfig() {
setScopeStart(startAddress);
setScopeEnd(endAddress);
}
@Override
protected void doEvent(RAMEvent e) {
int addr = e.getAddress();
if (addr < startAddress || addr > endAddress) {
return;
}
int pc = Emulator.computer.getCpu().programCounter;
if (e.getType() == TYPE.EXECUTE || e.getType() == TYPE.READ_OPERAND) {
if (pcActivity.containsKey(addr)) {
pcActivity.put(addr, Math.min(ACTIVITY_MAX, getInt(pcActivity.get(addr)) + ACTIVITY_INCREMENT));
} else {
pcActivity.put(addr, ACTIVITY_INCREMENT);
}
} else if (e.getType().isRead()) {
if (readActivity.containsKey(addr)) {
readActivity.put(addr, Math.min(ACTIVITY_MAX, getInt(readActivity.get(addr)) + ACTIVITY_INCREMENT));
} else {
readActivity.put(addr, ACTIVITY_INCREMENT);
}
readBy.put(addr, pc);
} else {
if (writeActivity.containsKey(addr)) {
writeActivity.put(addr, Math.min(ACTIVITY_MAX, getInt(writeActivity.get(addr)) + ACTIVITY_INCREMENT));
} else {
writeActivity.put(addr, ACTIVITY_INCREMENT);
}
valueActivity.put(addr, e.getNewValue());
setBy.put(addr, pc);
}
activeRam.add(addr);
}
};
Emulator.computer.getMemory().addListener(memoryListener);
redrawThread = new Thread(() -> {
if (mode == Modes.ACTIVITY) {
// Activity heatmap mode
while (isDisplayActive) {
updateDetails();
Graphics2D g = (Graphics2D) getGraphics();
for (Iterator<Integer> i = activeRam.iterator(); i.hasNext();) {
boolean remove = true;
int addr = i.next();
int read = getInt(readActivity.get(addr));
if (read <= 0) {
read = 0;
} else {
remove = false;
readActivity.put(addr, read - ACTIVITY_DECREMENT);
}
int write = getInt(writeActivity.get(addr));
if (write <= 0) {
write = 0;
} else {
remove = false;
writeActivity.put(addr, write - ACTIVITY_DECREMENT);
}
int pc = getInt(pcActivity.get(addr));
if (pc <= 0) {
pc = 0;
} else {
remove = false;
pcActivity.put(addr, pc - ACTIVITY_DECREMENT);
}
if (remove) {
i.remove();
pcActivity.remove(addr);
writeActivity.remove(addr);
readActivity.remove(addr);
}
drawActivity(addr, write, read, pc, g);
}
g.dispose();
try {
Thread.sleep(UPDATE_INTERVAL);
} catch (InterruptedException ex) {
Logger.getLogger(MemorySpyGrid.class.getName()).log(Level.SEVERE, null, ex);
}
}
} else {
// Redraw value, no activity counts needed
while (isDisplayActive) {
updateDetails();
Graphics2D g = (Graphics2D) getGraphics();
for (Iterator<Integer> i = valueActivity.keySet().iterator(); i.hasNext();) {
int addr = i.next();
int value = getInt(valueActivity.get(addr));
i.remove();
drawValue(addr, value, g);
}
g.dispose();
try {
Thread.sleep(UPDATE_INTERVAL);
} catch (InterruptedException ex) {
Logger.getLogger(MemorySpyGrid.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
redrawThread.setName("Memory spy redraw");
redrawThread.start();
}
void stopDisplay() {
isDisplayActive = false;
if (memoryListener != null) {
Emulator.computer.getMemory().removeListener(memoryListener);
memoryListener = null;
}
if (redrawThread != null && redrawThread.isAlive()) {
try {
redrawThread.join();
} catch (InterruptedException ex) {
Logger.getLogger(MemorySpyGrid.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
void setColorGradient(boolean useColor) {
if (useColor) {
gradient = colorGradient;
} else {
gradient = bwGradient;
}
repaint();
}
void setFastFade(boolean fast) {
if (fast) {
ACTIVITY_DECREMENT = 20;
} else {
ACTIVITY_DECREMENT = 5;
}
}
public static enum Modes {
ACTIVITY, VALUE
}
}

View File

@ -1,516 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="searchTypes">
</Component>
<Component class="javax.swing.ButtonGroup" name="valueTypes">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="tabs" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="tabs" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="tabs">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="cheatPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Cheats">
<Property name="tabTitle" type="java.lang.String" value="Cheats"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="activeCheatsScroll" pref="586" max="32767" attributes="0"/>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="activeCheatsLabel" min="-2" max="-2" attributes="0"/>
<Component id="addNewCheatLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="addByteValueButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="addWordValueButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="addValueLabel" min="-2" pref="56" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addValueField" min="-2" pref="79" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="addAddressLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addAddressField" min="-2" pref="79" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="disableCheatButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="enableCheatButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="removeSelectedButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="activeCheatsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="activeCheatsScroll" pref="118" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="removeSelectedButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="disableCheatButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="enableCheatButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addNewCheatLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addAddressLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addAddressField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addValueLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addValueField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addByteValueButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addWordValueButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="activeCheatsLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Active Cheats"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="activeCheatsScroll">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="activeCheatsTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="2" rowCount="0">
<Column editable="false" title="Address" type="java.lang.String"/>
<Column editable="false" title="Value" type="java.lang.String"/>
</Table>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="removeSelectedButton">
<Properties>
<Property name="text" type="java.lang.String" value="Remove Selected"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeSelectedButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="addNewCheatLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Add a new cheat:"/>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
</Component>
<Component class="javax.swing.JLabel" name="addValueLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Value"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="addAddressLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Address"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="addByteValueButton">
<Properties>
<Property name="text" type="java.lang.String" value="Add Byte Value"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addByteValueButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="addWordValueButton">
<Properties>
<Property name="text" type="java.lang.String" value="Add Word Value"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addWordValueButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="addAddressField">
</Component>
<Component class="javax.swing.JTextField" name="addValueField">
</Component>
<Component class="javax.swing.JButton" name="disableCheatButton">
<Properties>
<Property name="text" type="java.lang.String" value="Disable Selected"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="disableCheatButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="enableCheatButton">
<Properties>
<Property name="text" type="java.lang.String" value="Enable Selected"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableCheatButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="searchPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Search">
<Property name="tabTitle" type="java.lang.String" value="Search"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="resultsScroll" pref="569" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="addSelected" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="resultsStatusLabel" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="searchForLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="searchForChange" min="-2" max="-2" attributes="0"/>
<Component id="searchForValue" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="searchForByte" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="searchForWord" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="valueLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchNumber" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="resetButton" min="-2" pref="76" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="158" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="addWatchLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addWatchesButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="addStartLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="addEndLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="addEndNumber" max="32767" attributes="0"/>
<Component id="addStartNumber" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="searchForLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchForValue" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchForByte" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="searchForChange" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchForWord" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addStartLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addStartNumber" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="searchNumber" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="resetButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addEndLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addEndNumber" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addWatchesButton" alignment="3" min="-2" pref="24" max="-2" attributes="0"/>
<Component id="addWatchLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="resultsScroll" pref="195" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addSelected" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="resultsStatusLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="searchForValue">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="searchTypes"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Value"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="searchForValueActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="searchForLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Search for:"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="searchForChange">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="searchTypes"/>
</Property>
<Property name="text" type="java.lang.String" value="Change"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="searchForChangeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="searchNumber">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="searchNumberActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="valueLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Value:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="resetButton">
<Properties>
<Property name="text" type="java.lang.String" value="Reset"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="resetButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="searchButton">
<Properties>
<Property name="text" type="java.lang.String" value="Search"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="searchButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="resultsStatusLabel">
<Properties>
<Property name="text" type="java.lang.String" value="No results"/>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="resultsScroll">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="resultsTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="0">
<Column editable="false" title="Address" type="java.lang.String"/>
<Column editable="false" title="Last Search" type="java.lang.String"/>
<Column editable="false" title="Current Value" type="java.lang.String"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="false">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="false">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="false">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="false"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="addSelected">
<Properties>
<Property name="text" type="java.lang.String" value="Add Selected"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addSelectedActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="searchForByte">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="valueTypes"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Byte"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="searchForWord">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="valueTypes"/>
</Property>
<Property name="text" type="java.lang.String" value="Word"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="addWatchLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Add Watches:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="addStartLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="addStartNumber">
</Component>
<Component class="javax.swing.JTextField" name="addEndNumber">
</Component>
<Component class="javax.swing.JLabel" name="addEndLabel">
<Properties>
<Property name="text" type="java.lang.String" value="End"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="addWatchesButton">
<Properties>
<Property name="text" type="java.lang.String" value="Add"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addWatchesButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,623 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.cheat;
import jace.core.Utility;
import static jace.core.Utility.gripe;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* This is the metacheat user interface. The actual logic of metacheat is in the
* Metacheats class.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class MetaCheatForm extends javax.swing.JFrame {
/**
* Creates new form MetaCheatForm
*/
public MetaCheatForm() {
initComponents();
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
searchTypes = new javax.swing.ButtonGroup();
valueTypes = new javax.swing.ButtonGroup();
tabs = new javax.swing.JTabbedPane();
cheatPanel = new javax.swing.JPanel();
activeCheatsLabel = new javax.swing.JLabel();
activeCheatsScroll = new javax.swing.JScrollPane();
activeCheatsTable = new javax.swing.JTable();
removeSelectedButton = new javax.swing.JButton();
addNewCheatLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
addValueLabel = new javax.swing.JLabel();
addAddressLabel = new javax.swing.JLabel();
addByteValueButton = new javax.swing.JButton();
addWordValueButton = new javax.swing.JButton();
addAddressField = new javax.swing.JTextField();
addValueField = new javax.swing.JTextField();
disableCheatButton = new javax.swing.JButton();
enableCheatButton = new javax.swing.JButton();
searchPanel = new javax.swing.JPanel();
searchForValue = new javax.swing.JRadioButton();
searchForLabel = new javax.swing.JLabel();
searchForChange = new javax.swing.JRadioButton();
searchNumber = new javax.swing.JTextField();
valueLabel = new javax.swing.JLabel();
resetButton = new javax.swing.JButton();
searchButton = new javax.swing.JButton();
resultsStatusLabel = new javax.swing.JLabel();
resultsScroll = new javax.swing.JScrollPane();
resultsTable = new javax.swing.JTable();
addSelected = new javax.swing.JButton();
searchForByte = new javax.swing.JRadioButton();
searchForWord = new javax.swing.JRadioButton();
addWatchLabel = new javax.swing.JLabel();
addStartLabel = new javax.swing.JLabel();
addStartNumber = new javax.swing.JTextField();
addEndNumber = new javax.swing.JTextField();
addEndLabel = new javax.swing.JLabel();
addWatchesButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
activeCheatsLabel.setText("Active Cheats");
activeCheatsTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Address", "Value"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
activeCheatsScroll.setViewportView(activeCheatsTable);
removeSelectedButton.setText("Remove Selected");
removeSelectedButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeSelectedButtonActionPerformed(evt);
}
});
addNewCheatLabel.setText("Add a new cheat:");
addValueLabel.setText("Value");
addAddressLabel.setText("Address");
addByteValueButton.setText("Add Byte Value");
addByteValueButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addByteValueButtonActionPerformed(evt);
}
});
addWordValueButton.setText("Add Word Value");
addWordValueButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addWordValueButtonActionPerformed(evt);
}
});
disableCheatButton.setText("Disable Selected");
disableCheatButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
disableCheatButtonActionPerformed(evt);
}
});
enableCheatButton.setText("Enable Selected");
enableCheatButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enableCheatButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout cheatPanelLayout = new javax.swing.GroupLayout(cheatPanel);
cheatPanel.setLayout(cheatPanelLayout);
cheatPanelLayout.setHorizontalGroup(
cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(cheatPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(activeCheatsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
.addComponent(jSeparator1)
.addGroup(cheatPanelLayout.createSequentialGroup()
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(activeCheatsLabel)
.addComponent(addNewCheatLabel)
.addGroup(cheatPanelLayout.createSequentialGroup()
.addComponent(addByteValueButton)
.addGap(18, 18, 18)
.addComponent(addWordValueButton))
.addGroup(cheatPanelLayout.createSequentialGroup()
.addComponent(addValueLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addValueField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(cheatPanelLayout.createSequentialGroup()
.addComponent(addAddressLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addAddressField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(cheatPanelLayout.createSequentialGroup()
.addComponent(disableCheatButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enableCheatButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(removeSelectedButton)))
.addContainerGap())
);
cheatPanelLayout.setVerticalGroup(
cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(cheatPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(activeCheatsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(activeCheatsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(removeSelectedButton)
.addComponent(disableCheatButton)
.addComponent(enableCheatButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addNewCheatLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addAddressLabel)
.addComponent(addAddressField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addValueLabel)
.addComponent(addValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(cheatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addByteValueButton)
.addComponent(addWordValueButton))
.addContainerGap())
);
tabs.addTab("Cheats", cheatPanel);
searchTypes.add(searchForValue);
searchForValue.setSelected(true);
searchForValue.setText("Value");
searchForValue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchForValueActionPerformed(evt);
}
});
searchForLabel.setText("Search for:");
searchTypes.add(searchForChange);
searchForChange.setText("Change");
searchForChange.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchForChangeActionPerformed(evt);
}
});
searchNumber.setText("0");
searchNumber.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchNumberActionPerformed(evt);
}
});
valueLabel.setText("Value:");
resetButton.setText("Reset");
resetButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resetButtonActionPerformed(evt);
}
});
searchButton.setText("Search");
searchButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchButtonActionPerformed(evt);
}
});
resultsStatusLabel.setText("No results");
resultsStatusLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
resultsStatusLabel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
resultsTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Address", "Last Search", "Current Value"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
resultsTable.getTableHeader().setResizingAllowed(false);
resultsScroll.setViewportView(resultsTable);
resultsTable.getColumnModel().getColumn(0).setResizable(false);
resultsTable.getColumnModel().getColumn(1).setResizable(false);
resultsTable.getColumnModel().getColumn(2).setResizable(false);
addSelected.setText("Add Selected");
addSelected.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addSelectedActionPerformed(evt);
}
});
valueTypes.add(searchForByte);
searchForByte.setSelected(true);
searchForByte.setText("Byte");
valueTypes.add(searchForWord);
searchForWord.setText("Word");
addWatchLabel.setText("Add Watches:");
addStartLabel.setText("Start");
addEndLabel.setText("End");
addWatchesButton.setText("Add");
addWatchesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addWatchesButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout searchPanelLayout = new javax.swing.GroupLayout(searchPanel);
searchPanel.setLayout(searchPanelLayout);
searchPanelLayout.setHorizontalGroup(
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(resultsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
.addGroup(searchPanelLayout.createSequentialGroup()
.addComponent(addSelected)
.addGap(18, 18, 18)
.addComponent(resultsStatusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, searchPanelLayout.createSequentialGroup()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addComponent(searchForLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(searchForChange)
.addComponent(searchForValue))
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(searchForByte))
.addGroup(searchPanelLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(searchForWord))))
.addGroup(searchPanelLayout.createSequentialGroup()
.addComponent(valueLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(resetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchButton)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, searchPanelLayout.createSequentialGroup()
.addComponent(addWatchLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addWatchesButton))
.addGroup(searchPanelLayout.createSequentialGroup()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addStartLabel)
.addComponent(addEndLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addEndNumber)
.addComponent(addStartNumber))))))
.addContainerGap())
);
searchPanelLayout.setVerticalGroup(
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(searchForLabel)
.addComponent(searchForValue)
.addComponent(searchForByte))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(searchForChange)
.addComponent(searchForWord)
.addComponent(addStartLabel)
.addComponent(addStartNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(searchNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueLabel)
.addComponent(resetButton)
.addComponent(searchButton)
.addComponent(addEndLabel)
.addComponent(addEndNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(searchPanelLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addWatchesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addWatchLabel))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(resultsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addSelected)
.addComponent(resultsStatusLabel))
.addContainerGap())
);
tabs.addTab("Search", searchPanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(tabs)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(tabs)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void searchForValueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchForValueActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_searchForValueActionPerformed
private void searchForChangeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchForChangeActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_searchForChangeActionPerformed
private void searchNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchNumberActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_searchNumberActionPerformed
private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetButtonActionPerformed
MetaCheats.singleton.resetSearch();
resultsStatusLabel.setText("Results cleared.");
}//GEN-LAST:event_resetButtonActionPerformed
private void addSelectedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSelectedActionPerformed
List<Integer> addr = new ArrayList<Integer>(MetaCheats.singleton.results.keySet());
int val = Utility.parseHexInt(searchNumber.getText());
for (int i : resultsTable.getSelectedRows()) {
if (searchForByte.isSelected()) {
MetaCheats.singleton.addByteCheat(addr.get(i), val);
} else {
MetaCheats.singleton.addWordCheat(addr.get(i), val);
}
}
}//GEN-LAST:event_addSelectedActionPerformed
private void removeSelectedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeSelectedButtonActionPerformed
Set<Integer> remove = new HashSet<Integer>();
for (int i : activeCheatsTable.getSelectedRows()) {
String s = String.valueOf(activeCheatsTable.getModel().getValueAt(i, 0));
remove.add(Utility.parseHexInt(s));
}
for (int i : remove) {
MetaCheats.singleton.removeCheat(i);
}
}//GEN-LAST:event_removeSelectedButtonActionPerformed
private void addByteValueButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addByteValueButtonActionPerformed
try {
int addr = Utility.parseHexInt(addAddressField.getText());
int val = Utility.parseHexInt(addValueField.getText());
MetaCheats.singleton.addByteCheat(addr, val);
} catch (NullPointerException e) {
gripe("Please enure that the address and value fields are correctly filled in.");
}
}//GEN-LAST:event_addByteValueButtonActionPerformed
private void addWordValueButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordValueButtonActionPerformed
try {
int addr = Utility.parseHexInt(addAddressField.getText());
int val = Utility.parseHexInt(addValueField.getText());
MetaCheats.singleton.addWordCheat(addr, val);
} catch (NullPointerException e) {
gripe("Please enure that the address and value fields are correctly filled in.");
}
}//GEN-LAST:event_addWordValueButtonActionPerformed
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed
if (searchForChange.isSelected() == searchForValue.isSelected()) {
gripe("Please select if you want to search for a fixed value or a delta change");
return;
}
if (searchForByte.isSelected() == searchForWord.isSelected()) {
gripe("Please select if you want to search for a byte or a word value");
return;
}
try {
int val = Utility.parseHexInt(searchNumber.getText());
MetaCheats.singleton.performSearch(searchForChange.isSelected(), searchForByte.isSelected(), val);
} catch (NullPointerException e) {
gripe("Please enter a value");
}
}//GEN-LAST:event_searchButtonActionPerformed
private void disableCheatButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disableCheatButtonActionPerformed
for (int i : activeCheatsTable.getSelectedRows()) {
String s = String.valueOf(activeCheatsTable.getModel().getValueAt(i, 0));
MetaCheats.singleton.disableCheat(Utility.parseHexInt(s));
}
}//GEN-LAST:event_disableCheatButtonActionPerformed
private void enableCheatButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableCheatButtonActionPerformed
for (int i : activeCheatsTable.getSelectedRows()) {
String s = String.valueOf(activeCheatsTable.getModel().getValueAt(i, 0));
MetaCheats.singleton.enableCheat(Utility.parseHexInt(s));
}
}//GEN-LAST:event_enableCheatButtonActionPerformed
private void addWatchesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWatchesButtonActionPerformed
try {
int addrStart = Utility.parseHexInt(addStartNumber.getText());
int addrEnd = Utility.parseHexInt(addEndNumber.getText());
if (addrStart > addrEnd) {
gripe("Start address must be smaller than end address!");
return;
}
MetaCheats.singleton.addWatches(addrStart, addrEnd);
resultsStatusLabel.setText("Added range to watch list.");
} catch (NullPointerException e) {
gripe("Please enure that the start and end fields are correctly filled in.");
}
}//GEN-LAST:event_addWatchesButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MetaCheatForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MetaCheatForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MetaCheatForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MetaCheatForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MetaCheatForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JLabel activeCheatsLabel;
public javax.swing.JScrollPane activeCheatsScroll;
public javax.swing.JTable activeCheatsTable;
public javax.swing.JTextField addAddressField;
public javax.swing.JLabel addAddressLabel;
public javax.swing.JButton addByteValueButton;
public javax.swing.JLabel addEndLabel;
public javax.swing.JTextField addEndNumber;
public javax.swing.JLabel addNewCheatLabel;
public javax.swing.JButton addSelected;
public javax.swing.JLabel addStartLabel;
public javax.swing.JTextField addStartNumber;
public javax.swing.JTextField addValueField;
public javax.swing.JLabel addValueLabel;
public javax.swing.JLabel addWatchLabel;
public javax.swing.JButton addWatchesButton;
public javax.swing.JButton addWordValueButton;
public javax.swing.JPanel cheatPanel;
public javax.swing.JButton disableCheatButton;
public javax.swing.JButton enableCheatButton;
public javax.swing.JSeparator jSeparator1;
public javax.swing.JButton removeSelectedButton;
public javax.swing.JButton resetButton;
public javax.swing.JScrollPane resultsScroll;
public javax.swing.JLabel resultsStatusLabel;
public javax.swing.JTable resultsTable;
public javax.swing.JButton searchButton;
public javax.swing.JRadioButton searchForByte;
public javax.swing.JRadioButton searchForChange;
public javax.swing.JLabel searchForLabel;
public javax.swing.JRadioButton searchForValue;
public javax.swing.JRadioButton searchForWord;
public javax.swing.JTextField searchNumber;
public javax.swing.JPanel searchPanel;
public javax.swing.ButtonGroup searchTypes;
public javax.swing.JTabbedPane tabs;
public javax.swing.JLabel valueLabel;
public javax.swing.ButtonGroup valueTypes;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,290 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.cheat;
import jace.apple2e.RAM128k;
import jace.config.InvokableAction;
import jace.core.Computer;
import jace.core.KeyHandler;
import jace.core.Keyboard;
import jace.core.RAMEvent;
import jace.core.RAMListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javax.swing.table.DefaultTableModel;
/**
* Basic mame-style cheats. The user interface is in MetaCheatForm.
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class MetaCheats extends Cheats {
static MetaCheats singleton = null;
// This is used to help the handler exit faster when there is nothing to do
boolean noCheats = true;
public MetaCheats(Computer computer) {
super(computer);
singleton = this;
}
Map<Integer, Integer> holdBytes = new TreeMap<>();
Map<Integer, Integer> holdWords = new TreeMap<>();
Set<Integer> disabled = new HashSet<>();
Map<Integer, Integer> results = new TreeMap<>();
@Override
protected String getDeviceName() {
return "Meta-cheat engine";
}
@Override
public void tick() {
// Do nothing
}
public static int MAX_RESULTS_SHOWN = 256;
public MetaCheatForm form = null;
public boolean isDrawing = false;
public void redrawResults() {
if (isDrawing) {
return;
}
isDrawing = true;
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
Logger.getLogger(MetaCheats.class.getName()).log(Level.SEVERE, null, ex);
}
RAM128k ram = (RAM128k) computer.getMemory();
DefaultTableModel model = (DefaultTableModel) form.resultsTable.getModel();
if (results.size() > MAX_RESULTS_SHOWN) {
model.setRowCount(0);
isDrawing = false;
return;
}
boolean useWord = form.searchForWord.isSelected();
if (model.getRowCount() != results.size()) {
model.setRowCount(0);
List<Integer> iter = new ArrayList<>(results.keySet());
iter.stream().forEach((i) -> {
int val = results.get(i);
if (useWord) {
int current = ram.readWordRaw(i) & 0x0ffff;
model.addRow(new Object[]{hex(i, 4), val + " ("+hex(val,4)+")", current + " ("+hex(current,4)+")"});
} else {
int current = ram.readRaw(i) & 0x0ff;
model.addRow(new Object[]{hex(i, 4), val + " ("+hex(val,2)+")", current + " ("+hex(current,2)+")"});
}
});
} else {
List<Integer> iter = new ArrayList<>(results.keySet());
for (int i=0; i < iter.size(); i++) {
int val = results.get(iter.get(i));
if (useWord) {
int current = ram.readWordRaw(iter.get(i)) & 0x0ffff;
model.setValueAt(val + " ("+hex(val,4)+")", i, 1);
model.setValueAt(current + " ("+hex(current,4)+")", i, 2);
} else {
int current = ram.readRaw(iter.get(i)) & 0x0ff;
model.setValueAt(val + " ("+hex(val,2)+")", i, 1);
model.setValueAt(current + " ("+hex(current,2)+")", i, 2);
}
}
}
isDrawing = false;
}
public static String hex(int val, int size) {
String out = Integer.toHexString(val);
while (out.length() < size) {
out = "0"+out;
}
return "$"+out;
}
public void redrawCheats() {
noCheats = holdBytes.isEmpty() && holdWords.isEmpty() && disabled.isEmpty();
DefaultTableModel model = (DefaultTableModel) form.activeCheatsTable.getModel();
model.setRowCount(0);
holdBytes.keySet().stream().forEach((i) -> {
String loc = hex(i, 4);
if (disabled.contains(i)) loc += " (off)";
int val = holdBytes.get(i);
model.addRow(new Object[]{loc, val + " ("+hex(val,2)+")"});
});
holdWords.keySet().stream().forEach((i) -> {
String loc = hex(i, 4);
if (disabled.contains(i)) loc += " (off)";
int val = holdWords.get(i);
model.addRow(new Object[]{loc, val + " ("+hex(val,4)+")"});
});
}
@InvokableAction(name="Show Cheats", category = "cheats", defaultKeyMapping = "home")
public void showCheatForm() {
if (form == null) {
form = new MetaCheatForm();
}
form.setVisible(true);
}
MemorySpy spy = null;
@InvokableAction(name="Show Memory Spy", category = "cheats", defaultKeyMapping = "end")
public void showMemorySpy() {
if (spy == null) {
spy = new MemorySpy();
}
spy.setVisible(true);
}
@Override
public void registerListeners() {
this.addCheat(new RAMListener(RAMEvent.TYPE.READ, RAMEvent.SCOPE.ANY, RAMEvent.VALUE.ANY) {
@Override
protected void doConfig() {
}
@Override
protected void doEvent(RAMEvent e) {
if (noCheats) return;
if (disabled.contains(e.getAddress())) return;
if (holdBytes.containsKey(e.getAddress())) {
e.setNewValue(holdBytes.get(e.getAddress()));
} else if (holdWords.containsKey(e.getAddress())) {
e.setNewValue(holdWords.get(e.getAddress()) & 0x0ff);
} else if (holdWords.containsKey(e.getAddress()-1)) {
if (disabled.contains(e.getAddress()-1)) return;
e.setNewValue((holdWords.get(e.getAddress()-1)>>8) & 0x0ff);
}
}
});
this.addCheat(new RAMListener(RAMEvent.TYPE.WRITE, RAMEvent.SCOPE.ANY, RAMEvent.VALUE.ANY) {
@Override
protected void doConfig() {
}
@Override
protected void doEvent(RAMEvent e) {
if (results.isEmpty()) return;
if (results.size() > MAX_RESULTS_SHOWN || isDrawing) return;
if (results.containsKey(e.getAddress()) || results.containsKey(e.getAddress()-1)) {
Thread t = new Thread(() -> {
redrawResults();
});
t.setName("Metacheat results updater");
t.start();
}
}
});
}
public void addByteCheat(int addr, int val) {
holdBytes.put(addr, val);
redrawCheats();
}
public void addWordCheat(int addr, int val) {
holdWords.put(addr, val);
redrawCheats();
}
void removeCheat(int i) {
holdBytes.remove(i);
holdWords.remove(i);
disabled.remove(i);
redrawCheats();
}
void resetSearch() {
results.clear();
redrawResults();
}
void performSearch(boolean useDeltaSearch, boolean searchForByteValues, int val) {
RAM128k ram = (RAM128k) computer.getMemory();
if (results.isEmpty()) {
int max = 0x010000;
if (!searchForByteValues) max--;
for (int i=0; i < max; i++) {
if (i >= 0x0c000 && i <= 0x0cfff) continue;
int v = searchForByteValues ? ram.readRaw(i) & 0x0ff : ram.readWordRaw(i) & 0x0ffff;
if (useDeltaSearch) {
results.put(i, v);
} else if (v == val) {
results.put(i, v);
}
}
} else {
Set<Integer> remove = new HashSet<>();
results.keySet().stream().forEach((i) -> {
int v = searchForByteValues ? ram.readRaw(i) & 0x0ff : ram.readWordRaw(i) & 0x0ffff;
if (useDeltaSearch) {
if (v - results.get(i) != val) {
remove.add(i);
} else {
results.put(i,v);
}
} else {
if (v != val) {
remove.add(i);
} else {
results.put(i,v);
}
}
});
remove.stream().forEach((i) -> {
results.remove(i);
});
}
form.resultsStatusLabel.setText("Search found "+results.size()+" result(s).");
redrawResults();
}
void enableCheat(int addr) {
disabled.remove(addr);
redrawCheats();
}
void disableCheat(int addr) {
disabled.add(addr);
redrawCheats();
}
void addWatches(int addrStart, int addrEnd) {
RAM128k ram = (RAM128k) computer.getMemory();
if (form == null) return;
boolean searchForByteValues = form.searchForByte.isSelected();
for (int i = addrStart; i <= addrEnd; i = i + (searchForByteValues ? 1 : 2)) {
int v = searchForByteValues ? ram.readRaw(i) & 0x0ff : ram.readWordRaw(i) & 0x0ffff;
results.put(i,v);
}
redrawResults();
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.config.Configuration.ConfigNode;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JCheckBox;
/**
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
class BooleanComponent extends JCheckBox implements ActionListener {
ConfigNode node;
String fieldName;
public BooleanComponent(ConfigNode node, String fieldName) {
this.node = node;
this.fieldName = fieldName;
synchronizeValue();
addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
Boolean value = Boolean.valueOf(isSelected());
node.setFieldValue(fieldName, value);
}
public void synchronizeValue() {
try {
Object value = node.getFieldValue(fieldName);
if (value == null) {
setSelected(false);
} else {
setSelected(Boolean.valueOf(String.valueOf(value)).booleanValue());
}
} catch (IllegalArgumentException ex) {
Logger.getLogger(BooleanComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[650, 480]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="applyButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="revertButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="configTreeScrollPane" min="-2" pref="271" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="settingsPanel" pref="438" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="configTreeScrollPane" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="applyButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="saveButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="revertButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="settingsPanel" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="configTreeScrollPane">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTree" name="configTree">
<Properties>
<Property name="model" type="javax.swing.tree.TreeModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="null); //new Configuration.ConfigTreeModel()" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="valueChanged" listener="javax.swing.event.TreeSelectionListener" parameters="javax.swing.event.TreeSelectionEvent" handler="configTreeValueChanged"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="ConfigurationPanel_configTree"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="settingsPanel">
<Properties>
<Property name="alignmentX" type="float" value="0.0"/>
<Property name="alignmentY" type="float" value="0.0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[375, 480]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
</Container>
<Component class="javax.swing.JButton" name="applyButton">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
<Property name="toolTipText" type="java.lang.String" value="Apply current changes without saving"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="applyButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="saveButton">
<Properties>
<Property name="text" type="java.lang.String" value="Save"/>
<Property name="toolTipText" type="java.lang.String" value="Apply settings and save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="revertButton">
<Properties>
<Property name="text" type="java.lang.String" value="Revert"/>
<Property name="toolTipText" type="java.lang.String" value="Revert all settings to last saved values (hold SHIFT while clicking to revert to defaults)"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="revertButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -1,280 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.Emulator;
import jace.apple2e.Apple2e;
import jace.config.Configuration.ConfigNode;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.io.File;
import java.lang.reflect.Field;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JTree;
/**
* Configuration user interface. Not pretty but it works.
* Created on Dec 16, 2010, 3:23:13 PM
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class ConfigurationPanel extends javax.swing.JPanel {
public static void main(String... args) {
Emulator.computer.reconfigure();
Configuration.loadSettings();
JFrame f = new JFrame();
f.setContentPane(new ConfigurationPanel());
f.setSize(f.getContentPane().getPreferredSize());
f.validate();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
/** Creates new form ConfigurationPanel */
public ConfigurationPanel() {
initComponents();
expandAll(configTree);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
configTreeScrollPane = new javax.swing.JScrollPane();
configTree = new javax.swing.JTree();
settingsPanel = new javax.swing.JPanel();
applyButton = new javax.swing.JButton();
saveButton = new javax.swing.JButton();
revertButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(650, 480));
configTree.setModel(null); //new Configuration.ConfigTreeModel());
configTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
configTreeValueChanged(evt);
}
});
configTreeScrollPane.setViewportView(configTree);
settingsPanel.setAlignmentX(0.0F);
settingsPanel.setAlignmentY(0.0F);
settingsPanel.setPreferredSize(new java.awt.Dimension(375, 480));
settingsPanel.setLayout(new java.awt.GridBagLayout());
applyButton.setText("Apply");
applyButton.setToolTipText("Apply current changes without saving");
applyButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
applyButtonActionPerformed(evt);
}
});
saveButton.setText("Save");
saveButton.setToolTipText("Apply settings and save");
saveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveButtonActionPerformed(evt);
}
});
revertButton.setText("Revert");
revertButton.setToolTipText("Revert all settings to last saved values (hold SHIFT while clicking to revert to defaults)");
revertButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
revertButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(applyButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(revertButton))
.addComponent(configTreeScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(configTreeScrollPane)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(applyButton)
.addComponent(saveButton)
.addComponent(revertButton))
.addContainerGap())
.addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
ConfigNode currentNode = null;
private void configTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_configTreeValueChanged
settingsPanel.removeAll();
ConfigNode node = (ConfigNode) evt.getPath().getLastPathComponent();
if (currentNode == node) return;
currentNode = node;
if (node != null && node.subject != null && !node.getAllSettingNames().isEmpty()) {
GridBagLayout l = (GridBagLayout) settingsPanel.getLayout();
GridBagConstraints c = new GridBagConstraints();
int y = 0;
for (String s : node.getAllSettingNames()) {
try {
Field f = node.subject.getClass().getField(s);
ConfigurableField annotation = f.getAnnotation(ConfigurableField.class);
if (annotation == null) continue;
JLabel label = new JLabel(annotation.name());
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
c.gridy = y++;
c.gridx = 0;
c.weightx = 0.0;
c.insets = new Insets(2, 2, 2, 2);
c.ipady = 2;
settingsPanel.add(label,c);
Component edit = generateEditComponent(node, s);
edit.setSize(edit.getPreferredSize());
c.gridx = 1;
c.weightx = 0.5;
c.ipady = 0;
c.insets = new Insets(0, 2, 2, 2);
c.gridwidth = GridBagConstraints.REMAINDER;
settingsPanel.add(edit,c);
if (!annotation.description().equals("")) {
c.gridy = y++;
c.gridx = 0;
c.gridwidth = 2;
c.weightx = 0.0;
JLabel desc = new JLabel("<html><i>" + annotation.description());
c.insets = new Insets(1, 15, 7, 5);
settingsPanel.add(desc, c);
}
} catch (NoSuchFieldException ex) {
Logger.getLogger(ConfigurationPanel.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityException ex) {
Logger.getLogger(ConfigurationPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
settingsPanel.validate();
settingsPanel.setVisible(true);
settingsPanel.repaint();
}//GEN-LAST:event_configTreeValueChanged
private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed
Configuration.applySettings(Configuration.BASE);
configTree.updateUI();
expandAll(configTree);
}//GEN-LAST:event_applyButtonActionPerformed
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
Configuration.saveSettings();
configTree.updateUI();
expandAll(configTree);
}//GEN-LAST:event_saveButtonActionPerformed
private void revertButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_revertButtonActionPerformed
if ((evt.getModifiers() & evt.SHIFT_MASK) != 0) {
revertDefaultsActionPerformed(evt);
return;
}
Configuration.loadSettings();
configTree.updateUI();
expandAll(configTree);
}//GEN-LAST:event_revertButtonActionPerformed
private void revertDefaultsActionPerformed(java.awt.event.ActionEvent evt) {
if (JOptionPane.showConfirmDialog(null, "Revert all settings to defaults?", "Revert to defaults?", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
return;
Configuration.resetToDefaults();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton applyButton;
private javax.swing.JTree configTree;
private javax.swing.JScrollPane configTreeScrollPane;
private javax.swing.JButton revertButton;
private javax.swing.JButton saveButton;
private javax.swing.JPanel settingsPanel;
// End of variables declaration//GEN-END:variables
public void expandAll(JTree tree) {
for (int row = 0; row < tree.getRowCount(); tree.expandRow(row++));
}
private Component generateEditComponent(ConfigNode node, String s) {
try {
Field f = node.subject.getClass().getField(s);
if (f.getType().isPrimitive()) {
if (f.getType().equals(Boolean.TYPE)) {
return new BooleanComponent(node, s);
} else if (f.getType().equals(Integer.TYPE)) {
return new IntegerComponent(node, s);
} else if (f.getType().equals(Short.TYPE)) {
return new IntegerComponent(node, s);
} else if (f.getType().equals(Byte.TYPE)) {
return new IntegerComponent(node, s);
} else if (f.getType().equals(Long.TYPE)) {
return new IntegerComponent(node, s);
} else {
return new StringComponent(node, s);
}
} else if (f.getType().equals(String.class)) {
return new StringComponent(node, s);
} else if (f.getType().equals(File.class)) {
return new FileComponent(node, s);
} else if (Class.class.isEnum()) {
// TODO: Add enumeration support!
} else if (ISelection.class.isAssignableFrom(f.getType())) {
return new DynamicSelectComponent(node, s);
}
return new JTextField();
} catch (NoSuchFieldException ex) {
Logger.getLogger(ConfigurationPanel.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityException ex) {
Logger.getLogger(ConfigurationPanel.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}

View File

@ -1,151 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.config.Configuration.ConfigNode;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.event.ListDataListener;
/**
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
class DynamicSelectComponent extends JComboBox implements ActionListener {
ConfigNode node;
String fieldName;
Serializable currentValue;
@Override
public void actionPerformed(ActionEvent e) {
node.setFieldValue(fieldName, currentValue);
}
public void synchronizeValue() {
try {
Object value = node.getFieldValue(fieldName);
if (value == null) {
getModel().setSelectedItem(null);
setSelectedItem(getModel().getSelectedItem());
} else {
getModel().setSelectedItem(value);
setSelectedItem(getModel().getSelectedItem());
}
} catch (IllegalArgumentException ex) {
Logger.getLogger(StringComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
public DynamicSelectComponent(ConfigNode node, String fieldName) {
try {
this.node = node;
this.fieldName = fieldName;
DynamicSelection sel;
try {
sel = (DynamicSelection) node.subject.getClass().getField(fieldName).get(node.subject);
} catch (IllegalArgumentException ex) {
Logger.getLogger(DynamicSelectComponent.class.getName()).log(Level.SEVERE, null, ex);
System.err.print("Couldn't get selections for field " + fieldName);
return;
} catch (IllegalAccessException ex) {
Logger.getLogger(DynamicSelectComponent.class.getName()).log(Level.SEVERE, null, ex);
System.err.print("Couldn't get selections for field " + fieldName);
return;
} catch (NoSuchFieldException ex) {
Logger.getLogger(DynamicSelectComponent.class.getName()).log(Level.SEVERE, null, ex);
System.err.print("Couldn't get selections for field " + fieldName);
return;
} catch (SecurityException ex) {
Logger.getLogger(DynamicSelectComponent.class.getName()).log(Level.SEVERE, null, ex);
System.err.print("Couldn't get selections for field " + fieldName);
return;
}
currentValue = node.getFieldValue(fieldName);
final LinkedHashMap selections = sel.getSelections();
addActionListener(this);
ComboBoxModel m;
setModel(new ComboBoxModel() {
Entry value;
public void setSelectedItem(Object anItem) {
if (anItem != null && anItem instanceof Map.Entry) {
value = (Entry) anItem;
currentValue = (Serializable) ((Entry) anItem).getKey();
} else {
for (Map.Entry entry : (Set<Map.Entry>) selections.entrySet()) {
if (entry.getValue().equals(anItem)) {
value = entry;
currentValue = (Serializable) entry.getKey();
}
if (entry.getKey() == null && anItem == null) {
value = entry;
currentValue = (Serializable) entry.getKey();
}
if (entry.getKey() != null && entry.equals(anItem)) {
value = entry;
currentValue = (Serializable) entry.getKey();
}
}
}
}
public Object getSelectedItem() {
return selections.get(currentValue);
}
public int getSize() {
return selections.size();
}
public Object getElementAt(int index) {
for (Map.Entry entry : (Set<Map.Entry>) selections.entrySet()) {
if (index == 0) {
return entry.getValue();
}
index--;
}
return null;
}
public void addListDataListener(ListDataListener l) {
}
public void removeListDataListener(ListDataListener l) {
}
});
synchronizeValue();
} catch (SecurityException ex) {
Logger.getLogger(DynamicSelectComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -1,287 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.config.Configuration.ConfigNode;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
/**
* This component provides a text field for the manual input of a file, as well
* as an associated 'Browse' button, allowing the user to browse for a file and
* have its location show up automatically in the text field.
*
* --borrowed and modified by Brendan Robert
*
* @author Eelke Spaak
* @see javax.swing.JFileChooser
*/
class FileComponent extends javax.swing.JPanel implements ActionListener, KeyListener {
ConfigNode node;
String fieldName;
public void actionPerformed(ActionEvent e) {
textField.setBackground(Color.WHITE);
String value = textField.getText();
if (value == null || value.equals("")) {
node.setFieldValue(fieldName, null);
} else {
File f = new File(value);
if (f.exists()) {
node.setFieldValue(fieldName, f);
} else {
textField.setBackground(Color.RED);
}
}
}
public void synchronizeValue() {
try {
Object value = node.getFieldValue(fieldName);
if (value == null) {
setText("");
} else {
setText(String.valueOf(value));
}
} catch (IllegalArgumentException ex) {
Logger.getLogger(StringComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
private int TEXT_FIELD_WIDTH = 150;
/** Creates new form JFileField */
public FileComponent(ConfigNode node, String fieldName) {
this.node = node;
this.fieldName = fieldName;
// if (".".equals(type.value())) {
// fileSelectionMode = JFileChooser.DIRECTORIES_ONLY;
// } else {
// setFileTypeName(type.value());
// setExtensionFilter(type.value());
// }
initComponents();
textField.addActionListener(this);
synchronizeValue();
}
private String extensionFilter;
private String fileTypeName;
private int fileSelectionMode = JFileChooser.FILES_ONLY;
/** This method is called from within the constructor to
* initialize the form.
*/
private void initComponents() {
textField = new javax.swing.JTextField();
browseButton = new javax.swing.JButton();
textField.setPreferredSize(new Dimension(150,20));
textField.addKeyListener(this);
browseButton.setText("...");
browseButton.setPreferredSize(new Dimension(25,20));
browseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
browseButtonActionPerformed(evt);
}
});
this.add(textField);
this.add(browseButton);
FlowLayout layout = new FlowLayout();
this.setLayout(layout);
this.validate();
}
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {
File currentDirectory = new File(".");
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(fileSelectionMode);
// Quick-n-dirty implementation of file extension filter since it's new in JDK 1.6
if (extensionFilter != null && fileTypeName != null) {
FileFilter filter = new FileFilter() {
String[] extensions = extensionFilter.toLowerCase().split(",");
@Override
public boolean accept(File f) {
for (int i=0; i < extensions.length; i++) {
if (f.getPath().toLowerCase().endsWith(extensions[i]))
return true;
}
return false;
}
@Override
public String getDescription() {
return fileTypeName;
}
};
chooser.setFileFilter(filter);
}
try {
File f = new File(textField.getText());
if (f.exists()) {
if (f.isDirectory()) {
chooser.setCurrentDirectory(f);
} else {
chooser.setCurrentDirectory(f.getParentFile());
chooser.setSelectedFile(f);
}
} else {
chooser.setCurrentDirectory(currentDirectory);
}
} catch (Exception ignore) {
}
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
try {
File selectedFile = chooser.getSelectedFile();
if (selectedFile.getCanonicalPath().startsWith(currentDirectory.getCanonicalPath())) {
String use = selectedFile.getCanonicalPath().substring(currentDirectory.getCanonicalPath().length() + 1);
textField.setText(use);
} else {
textField.setText(selectedFile.getPath());
}
node.setFieldValue(fieldName, selectedFile);
} catch (IOException ex) {
Logger.getLogger(FileComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
/**
* Returns the value of the text field.
*
* @return the value of the text field
*/
public String getText() {
return textField.getText();
}
/**
* Sets the value of the text field.
*
* @param the value to put in the text field
*/
public void setText(String text) {
textField.setText(text);
}
/**
* Returns the extension filter (a comma-separated string of extensions)
* that the JFileChooser should use when browsing for a file.
*
* @return the extension filter
*/
public String getExtensionFilter() {
return extensionFilter;
}
/**
* Sets the extension filter (a comma-separated string of extensions)
* that the JFileChooser should use when browsing for a file.
*
* @param extensionFilter the extension filter
*/
public void setExtensionFilter(String extensionFilter) {
this.extensionFilter = extensionFilter;
}
/**
* Returns the description of the file types the JFileChooser should be
* browsing for.
*
* @return the file type description
*/
public String getFileTypeName() {
return fileTypeName;
}
/**
* Sets the description of the file types the JFileChooser should be
* browsing for.
*
* @param fileTypeName the file type description
*/
public void setFileTypeName(String fileTypeName) {
this.fileTypeName = fileTypeName;
}
/**
* Returns the file selection mode to be used by the JFileChooser.
*
* @return the type of files to be displayed
* @see javax.swing.JFileChooser#getFileSelectionMode()
*/
public int getFileSelectionMode() {
return fileSelectionMode;
}
/**
* Sets the file selection mode to be used by the JFileChooser.
*
* @param fileSelectionMode the type of files to be displayed
* @see javax.swing.JFileChooser#setFileSelectionMode(int)
*/
public void setFileSelectionMode(int fileSelectionMode) {
this.fileSelectionMode = fileSelectionMode;
}
/**
* Implemented to make layout managers align the JFileField on the baseline
* of the included text field, rather than on the absolute bottom of the
* JPanel.
*
* @param w
* @param h
* @return
*/
// @Override
// public int getBaseline(int w, int h) {
// return textField.getBaseline(w, h);
// }
// Variables declaration - do not modify
private javax.swing.JButton browseButton;
private javax.swing.JTextField textField;
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
actionPerformed(null);
}
// End of variables declaration
}

View File

@ -1,65 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.config.Configuration.ConfigNode;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class IntegerComponent extends StringComponent {
@Override
public void keyReleased(KeyEvent e) {
String t = getText();
if (t == null || t.equals("")) {
try {
ConfigurableField f = node.subject.getClass().getField(fieldName).getAnnotation(ConfigurableField.class);
t = f.defaultValue();
if (t == null || t.equals("")) {
t = "0";
}
// setText(t);
} catch (NoSuchFieldException ex) {
Logger.getLogger(IntegerComponent.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityException ex) {
Logger.getLogger(IntegerComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
try {
int i = Integer.parseInt(t);
node.setFieldValue(fieldName, i);
setBackground(Color.white);
} catch (NumberFormatException ex) {
setBackground(Color.red);
}
}
public IntegerComponent(ConfigNode node, String fieldName) {
super(node, fieldName);
setColumns(10);
}
}

View File

@ -1,65 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.config;
import jace.config.Configuration.ConfigNode;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTextField;
/**
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
class StringComponent extends JTextField implements KeyListener {
ConfigNode node;
String fieldName;
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
node.setFieldValue(fieldName, getText());
}
public StringComponent(ConfigNode node, String fieldName) {
this.node = node;
this.fieldName = fieldName;
synchronizeValue();
addKeyListener(this);
}
public void synchronizeValue() {
try {
Object value = node.getFieldValue(fieldName);
if (value == null) {
setText("");
} else {
setText(String.valueOf(value));
}
} catch (IllegalArgumentException ex) {
Logger.getLogger(StringComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -1,494 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import jace.config.ConfigurableField;
import jace.config.Reconfigurable;
import jace.core.Computer;
import java.awt.Color;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Graphics2D;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* This is an abstraction of the emulator user interface. It defines a lot of
* the management of user interface elements (such as screen indicators) as well
* as window management (resize, fullscreen, etc)
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public abstract class AbstractEmulatorFrame extends javax.swing.JFrame implements Reconfigurable {
Computer computer;
/**
* Creates new form AbstractEmulatorFrame
*/
public AbstractEmulatorFrame() {
initComponents();
}
public void setComputer(Computer computer) {
this.computer = computer;
}
@Override
public synchronized void addKeyListener(KeyListener l) {
super.addKeyListener(l);
getScreen().addKeyListener(l);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
@Override
abstract public String getShortName();
@ConfigurableField(name = "Show Debug Panel")
public Boolean showDebug = false;
@Override
public void reconfigure() {
getDebuggerPanel().setVisible(isShowDebug());
resizeVideo();
}
abstract public DebuggerPanel getDebuggerPanel();
/**
* @return the showDebug
*/
public boolean isShowDebug() {
return showDebug;
}
/**
* @param showDebug the showDebug to set
*/
public void setShowDebug(boolean showDebug) {
this.showDebug = showDebug;
}
public void addIndicator(Object owner, ImageIcon icon, int time) {
synchronized (indicators) {
Set<ImageIcon> ind = indicators.get(owner);
if (ind == null) {
ind = new HashSet<ImageIcon>();
indicators.put(owner, ind);
}
removeTime.put(icon, System.currentTimeMillis() + time);
if (ind.contains(icon)) {
return;
}
ind.add(icon);
}
redrawIndicators();
}
public static int DEFAULT_INDICATOR_TIME = 250;
public void addIndicator(Object owner, ImageIcon icon) {
addIndicator(owner, icon, DEFAULT_INDICATOR_TIME);
}
public void removeIndicator(Object owner, ImageIcon icon, boolean redraw) {
synchronized (indicators) {
Set<ImageIcon> ind = indicators.get(owner);
if (ind != null) {
ind.remove(icon);
}
removeTime.remove(icon);
}
if (redraw) {
redrawIndicators();
}
}
public void removeIndicator(Object owner, ImageIcon icon) {
removeIndicator(owner, icon, true);
}
public void removeIndicators(Object owner) {
synchronized (indicators) {
Set<ImageIcon> ind = indicators.get(owner);
if (ind == null) {
return;
}
for (ImageIcon i : ind) {
removeTime.remove(i);
}
indicators.remove(owner);
}
redrawIndicators();
}
Lock indicatorLock = new ReentrantLock();
Thread indicatorThread;
public void redrawIndicators() {
final HashSet<ImageIcon> i = new HashSet<ImageIcon>();
HashSet<ImageIcon> removeList = new HashSet<ImageIcon>();
long now = System.currentTimeMillis();
long soonest = Long.MAX_VALUE;
synchronized (indicators) {
for (Object owner : indicators.keySet()) {
Set<ImageIcon> ind = indicators.get(owner);
for (ImageIcon icon : ind) {
long rt = removeTime.get(icon);
if (rt <= now) {
removeList.add(icon);
} else {
i.add(icon);
if (rt < soonest) {
soonest = rt;
}
}
}
for (ImageIcon remove : removeList) {
removeIndicator(owner, remove, false);
}
}
}
boolean changed = false;
if (visibleIndicators == null) {
changed = true;
} else if (i.size() != visibleIndicators.size() || !i.containsAll(visibleIndicators)) {
changed = true;
}
if (changed) {
visibleIndicators = i;
doRedrawIndicators(visibleIndicators);
}
resumeIndicatorLoop();
}
Set<ImageIcon> visibleIndicators;
private void resumeIndicatorLoop() {
try {
indicatorLock.lock();
if (indicatorThread == null || !indicatorThread.isAlive()) {
indicatorThread = new Thread(new Runnable() {
@Override
public void run() {
while (visibleIndicators != null) {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
return;
}
redrawIndicators();
if (visibleIndicators.isEmpty()) {
visibleIndicators = null;
}
}
}
});
indicatorThread.start();
}
} finally {
indicatorLock.unlock();
}
}
private void suspendIndicatorLoop() {
try {
indicatorLock.lock();
visibleIndicators.clear();
indicatorThread.interrupt();
indicatorThread = null;
} finally {
indicatorLock.unlock();
}
}
abstract public void doRedrawIndicators(Set<ImageIcon> indicators);
private Map<ImageIcon, Long> removeTime = new HashMap<ImageIcon, Long>();
private Map<Object, Set<ImageIcon>> indicators = new HashMap<Object, Set<ImageIcon>>();
public void resizeVideo() {
EventQueue.invokeLater(() -> {
computer.pause();
computer.getVideo().suspend();
JPanel debugger = getDebuggerPanel();
Component screen = getScreen();
Rectangle bounds = screen.getParent().getBounds();
int width1 = (int) bounds.getWidth();
int height1 = (int) bounds.getHeight();
if (debugger.isVisible()) {
debugger.setBounds(width1 - debugger.getWidth(), 0, debugger.getWidth(), height1);
width1 = (int) bounds.getWidth() - debugger.getWidth() + 1;
screen.setSize(width1, height1);
debugger.revalidate();
} else {
screen.setSize(width1, height1);
}
computer.getVideo().setWidth(width1);
computer.getVideo().setHeight(height1);
if (!isFullscreen || !fullscreenEnforceRatio) {
// computer.getVideo().setScreen(getScreenGraphics());
}
computer.getVideo().forceRefresh();
screen.validate();
screen.requestFocusInWindow();
computer.resume();
computer.getVideo().resume();
});
}
abstract public Component getScreen();
boolean fullscreenEnforceRatio = false;
public void enforceIntegerRatio() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
int ww = getWidth();
int wh = getHeight();
int w = getContentPane().getWidth();
int h = getContentPane().getHeight();
int bw = ww - w;
int bh = wh - h;
double dhscale = w / 560.0;
double dvscale = h / 384.0;
int hscale = (int) Math.round(dhscale);
int vscale = (int) Math.round(dvscale);
int scale = Math.min(hscale, vscale);
if (scale < 1) {
scale = 1;
}
Rectangle b = getBounds();
if (!isFullscreen) {
b.setSize(bw + 560 * scale, bh + 384 * scale);
setBounds(b);
} else {
fullscreenEnforceRatio = !fullscreenEnforceRatio;
if (fullscreenEnforceRatio) {
int sw = getBounds().width;
int sh = getBounds().height;
while ((560 * scale) > sw || (384 * scale) > sh) {
scale--;
}
b.setSize(560 * scale, 384 * scale);
b.x = (w / 2) - (b.width / 2);
b.y = (h / 2) - (b.height / 2);
computer.pause();
computer.getVideo().suspend();
try {
Thread.sleep(100);
} catch (InterruptedException ex) {
}
Graphics2D g = (Graphics2D) getScreenGraphics();
g.setColor(new Color(0, 0, 0x040));
g.fill(getBounds());
Graphics2D gg = (Graphics2D) g.create(b.x, b.y, b.width, b.height);
gg.scale((double) b.width / (double) sw, (double) b.height / (double) sh);
// computer.getVideo().setScreen(gg);
computer.getVideo().resume();
computer.resume();
} else {
b = getBounds();
getScreen().setBounds(getBounds());
}
}
resizeVideo();
}
});
}
abstract public void repaintIndicators();
public Graphics2D getScreenGraphics() {
return (Graphics2D) getScreen().getGraphics();
}
boolean isFullscreen = false;
public boolean isFullscreenActive() {
return isFullscreen;
}
public void toggleFullscreen() {
final JFrame window = this;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
computer.pause();
computer.getVideo().suspend();
isFullscreen = !isFullscreen;
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if (isFullscreen) {
removeNotify();
setUndecorated(true);
validate();
addNotify();
device.setFullScreenWindow(window);
fullscreenEnforceRatio = false;
} else {
removeNotify();
setUndecorated(false);
addNotify();
device.setFullScreenWindow(null);
}
resizeVideo();
computer.getVideo().resume();
computer.resume();
}
});
}
private class Dialog {
JPanel ui;
String name;
Dialog parent;
boolean disposeOnClose;
}
Dialog visibleDialog = null;
Map<String, Dialog> registeredModalDialogs = new HashMap<String, Dialog>();
public JPanel getModalDialogUI(String name) {
Dialog dialog = registeredModalDialogs.get(name);
return dialog != null ? dialog.ui : null;
}
public void registerModalDialog(JPanel ui, String name, String parent, boolean disposeOnClose) {
Dialog dialog = new Dialog();
dialog.ui = ui;
dialog.parent = registeredModalDialogs.get(parent);
dialog.name = name;
dialog.disposeOnClose = disposeOnClose;
registeredModalDialogs.put(name, dialog);
}
public void closeDialog(String name) {
Dialog d = registeredModalDialogs.get(name);
if (d == null) return;
Dialog parent = d.parent;
if (d.disposeOnClose) {
removeDialogAndChildren(d);
disposeModalDialog(name);
}
// If this operation somehow affected the visible dialog, show its parent if possible
while (!registeredModalDialogs.containsValue(parent) && parent != null) {
parent = parent.parent;
}
showDialog(parent);
}
// Close/hide the current dialog
// If the disposeOnClose flag is true then the dialog will be removed
// completely. Some dialogs such as configuration will have this set
// to false to avoid having to be regenerated unnecessarily.
public void closeDialog() {
if (visibleDialog == null) {
return;
}
if (visibleDialog.disposeOnClose) {
removeDialogAndChildren(visibleDialog);
} else {
hideModalDialog(visibleDialog.name);
}
showDialog(visibleDialog.parent);
}
// Recursively remove a dialog and any children that were registered
// This is a depth-first operation out of necessity since the actual
// stoage structure is flat.
private void removeDialogAndChildren(Dialog d) {
if (d == null) {
return;
}
for (Dialog child : registeredModalDialogs.values()) {
if (child.parent == null || !child.parent.equals(d)) {
continue;
}
removeDialogAndChildren(child);
}
registeredModalDialogs.remove(d.name);
}
public void showDialog(String name) {
Dialog d = registeredModalDialogs.get(name);
if (d == null) {
return;
}
showDialog(d);
}
protected void showDialog(Dialog d) {
if (d == null) {
// Uh oh... why are we asked to show nothing?
System.err.println("WARNING: Asked to show a null modal dialog!");
return;
}
if (d.parent != null && d.parent.equals(visibleDialog)) {
// The new dialog is a child of the visible dialog, preserve the parent dialog
} else if (visibleDialog != null) {
// The new dialog has no child relationship with the current dialog.
// This means that the old dialog should be considered closed.
if (visibleDialog.disposeOnClose) {
removeDialogAndChildren(d);
}
}
List<String> ancestors = new ArrayList<String>();
for (Dialog parent = d.parent; parent != null; parent = parent.parent) {
ancestors.add(0, parent.name);
}
displayModalDialog(d.name, d.ui, ancestors);
visibleDialog = d;
}
abstract protected void displayModalDialog(String name, JPanel ui, List<String> ancestors);
abstract protected void disposeModalDialog(String name);
abstract protected void hideModalDialog(String name);
}

View File

@ -1,598 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="28" green="0" red="0" type="rgb"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 492]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelWatches" alignment="0" max="32767" attributes="2"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="textW4" alignment="0" max="32767" attributes="1"/>
<Component id="textW3" alignment="0" max="32767" attributes="1"/>
<Component id="textW2" alignment="0" max="32767" attributes="1"/>
<Component id="textW1" alignment="0" min="-2" pref="34" max="-2" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="valueW4" alignment="0" min="-2" max="-2" attributes="1"/>
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
<Component id="valueW3" alignment="0" max="32767" attributes="1"/>
<Component id="valueW2" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="valueW1" alignment="0" min="-2" max="-2" attributes="1"/>
</Group>
</Group>
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
</Group>
<Component id="enableDebug" alignment="0" max="32767" attributes="2"/>
<Group type="102" alignment="0" attributes="0">
<Component id="labelBreakPoints" min="-2" max="-2" attributes="2"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="enableTrace" alignment="0" max="32767" attributes="2"/>
<Component id="stepForwardButton" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace min="51" pref="51" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelA" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelPC1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="1">
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="valuePC2" pref="18" max="32767" attributes="1"/>
</Group>
<Group type="102" alignment="0" attributes="1">
<Component id="labelPC" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valuePC" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelSP" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelY" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelX" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="valueSP" alignment="0" max="32767" attributes="1"/>
<Component id="valueY" alignment="0" max="32767" attributes="1"/>
<Component id="valueA" alignment="0" max="32767" attributes="1"/>
<Component id="valueX" alignment="0" pref="18" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
<Component id="labelINST" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="textBP4" alignment="0" max="32767" attributes="1"/>
<Component id="textBP3" alignment="0" max="32767" attributes="1"/>
<Component id="textBP2" alignment="0" max="32767" attributes="1"/>
<Component id="textBP1" alignment="0" min="-2" pref="33" max="-2" attributes="1"/>
</Group>
<Component id="valueINST" alignment="0" min="-2" pref="60" max="-2" attributes="1"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelA" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueA" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueX" alignment="3" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueY" alignment="3" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelSP" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueSP" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelPC" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valuePC" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelPC1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valuePC2" alignment="3" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelINST" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueINST" min="-2" pref="13" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelBreakPoints" min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textBP1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textBP2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textBP3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textBP4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelWatches" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textW1" alignment="3" min="-2" pref="19" max="-2" attributes="0"/>
<Component id="valueW1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textW2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueW2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textW3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="valueW3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="textW4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="valueW4" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="stepForwardButton" min="-2" pref="23" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="enableDebug" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="enableTrace" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="labelA">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="A:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelX">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="X:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelY">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Y:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelSP">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="SP:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelPC">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="PC:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelINST">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Instruction:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="valueA">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueX">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueY">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueSP">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valuePC">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueINST">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="BRK"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JCheckBox" name="enableDebug">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="0" red="0" type="rgb"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Debug?"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="contentAreaFilled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableDebugActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="labelPC1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="FL:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="valuePC2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="stepForwardButton">
<Properties>
<Property name="text" type="java.lang.String" value="Step"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="stepForwardButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="labelBreakPoints">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Breakpoints:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelWatches">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Watches:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textBP1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textBP1breakpointKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textBP2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textBP2breakpointKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textBP3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textBP3breakpointKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textBP4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textBP4breakpointKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textW1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textW1watchKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textW2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textW2watchKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textW3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textW3watchKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textW4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textW4watchKeyPressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueW1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueW2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueW3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="valueW4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="00"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JCheckBox" name="enableTrace">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="0" red="0" type="rgb"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Trace?"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Border>
</Property>
<Property name="contentAreaFilled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableTraceActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@ -1,454 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import jace.EmulatorUILogic;
/**
* Simple debugger panel user interface. It gets the job done, but only just.
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class DebuggerPanel extends javax.swing.JPanel {
/**
* Creates new form DebuggerPanel
*/
public DebuggerPanel() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
labelA = new javax.swing.JLabel();
labelX = new javax.swing.JLabel();
labelY = new javax.swing.JLabel();
labelSP = new javax.swing.JLabel();
labelPC = new javax.swing.JLabel();
labelINST = new javax.swing.JLabel();
valueA = new javax.swing.JLabel();
valueX = new javax.swing.JLabel();
valueY = new javax.swing.JLabel();
valueSP = new javax.swing.JLabel();
valuePC = new javax.swing.JLabel();
valueINST = new javax.swing.JLabel();
enableDebug = new javax.swing.JCheckBox();
labelPC1 = new javax.swing.JLabel();
valuePC2 = new javax.swing.JLabel();
stepForwardButton = new javax.swing.JButton();
labelBreakPoints = new javax.swing.JLabel();
labelWatches = new javax.swing.JLabel();
textBP1 = new javax.swing.JTextField();
textBP2 = new javax.swing.JTextField();
textBP3 = new javax.swing.JTextField();
textBP4 = new javax.swing.JTextField();
textW1 = new javax.swing.JTextField();
textW2 = new javax.swing.JTextField();
textW3 = new javax.swing.JTextField();
textW4 = new javax.swing.JTextField();
valueW1 = new javax.swing.JLabel();
valueW2 = new javax.swing.JLabel();
valueW3 = new javax.swing.JLabel();
valueW4 = new javax.swing.JLabel();
enableTrace = new javax.swing.JCheckBox();
setBackground(new java.awt.Color(0, 0, 40));
setDoubleBuffered(false);
setPreferredSize(new java.awt.Dimension(100, 492));
labelA.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelA.setForeground(new java.awt.Color(255, 255, 102));
labelA.setText("A:");
labelX.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelX.setForeground(new java.awt.Color(255, 255, 102));
labelX.setText("X:");
labelY.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelY.setForeground(new java.awt.Color(255, 255, 102));
labelY.setText("Y:");
labelSP.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelSP.setForeground(new java.awt.Color(255, 255, 102));
labelSP.setText("SP:");
labelPC.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelPC.setForeground(new java.awt.Color(255, 255, 102));
labelPC.setText("PC:");
labelINST.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelINST.setForeground(new java.awt.Color(255, 255, 102));
labelINST.setText("Instruction:");
valueA.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueA.setForeground(new java.awt.Color(255, 255, 255));
valueA.setText("00");
valueX.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueX.setForeground(new java.awt.Color(255, 255, 255));
valueX.setText("00");
valueY.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueY.setForeground(new java.awt.Color(255, 255, 255));
valueY.setText("00");
valueSP.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueSP.setForeground(new java.awt.Color(255, 255, 255));
valueSP.setText("00");
valuePC.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valuePC.setForeground(new java.awt.Color(255, 255, 255));
valuePC.setText("00");
valueINST.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueINST.setForeground(new java.awt.Color(255, 255, 255));
valueINST.setText("BRK");
enableDebug.setBackground(new java.awt.Color(0, 0, 255));
enableDebug.setForeground(new java.awt.Color(255, 255, 102));
enableDebug.setText("Debug?");
enableDebug.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
enableDebug.setContentAreaFilled(false);
enableDebug.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enableDebugActionPerformed(evt);
}
});
labelPC1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelPC1.setForeground(new java.awt.Color(255, 255, 102));
labelPC1.setText("FL:");
valuePC2.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valuePC2.setForeground(new java.awt.Color(255, 255, 255));
valuePC2.setText("00");
stepForwardButton.setText("Step");
stepForwardButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
stepForwardButtonActionPerformed(evt);
}
});
labelBreakPoints.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelBreakPoints.setForeground(new java.awt.Color(255, 255, 102));
labelBreakPoints.setText("Breakpoints:");
labelWatches.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
labelWatches.setForeground(new java.awt.Color(255, 255, 102));
labelWatches.setText("Watches:");
textBP1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textBP1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textBP1breakpointKeyPressed(evt);
}
});
textBP2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textBP2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textBP2breakpointKeyPressed(evt);
}
});
textBP3.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textBP3.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textBP3breakpointKeyPressed(evt);
}
});
textBP4.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textBP4.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textBP4breakpointKeyPressed(evt);
}
});
textW1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textW1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textW1watchKeyPressed(evt);
}
});
textW2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textW2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textW2watchKeyPressed(evt);
}
});
textW3.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textW3.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textW3watchKeyPressed(evt);
}
});
textW4.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
textW4.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
textW4watchKeyPressed(evt);
}
});
valueW1.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueW1.setForeground(new java.awt.Color(255, 255, 255));
valueW1.setText("00");
valueW2.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueW2.setForeground(new java.awt.Color(255, 255, 255));
valueW2.setText("00");
valueW3.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueW3.setForeground(new java.awt.Color(255, 255, 255));
valueW3.setText("00");
valueW4.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
valueW4.setForeground(new java.awt.Color(255, 255, 255));
valueW4.setText("00");
enableTrace.setBackground(new java.awt.Color(0, 0, 255));
enableTrace.setForeground(new java.awt.Color(255, 255, 102));
enableTrace.setText("Trace?");
enableTrace.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
enableTrace.setContentAreaFilled(false);
enableTrace.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enableTraceActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelWatches, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(textW4, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textW3, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textW2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textW1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(valueW4)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(valueW3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(valueW2)
.addComponent(valueW1)))
.addGap(24, 24, 24))
.addComponent(enableDebug, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(labelBreakPoints)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(enableTrace, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(stepForwardButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(51, 51, 51))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelA)
.addComponent(labelPC1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(valuePC2, javax.swing.GroupLayout.DEFAULT_SIZE, 18, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(labelPC)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valuePC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelSP)
.addComponent(labelY)
.addComponent(labelX))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(valueSP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(valueY, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(valueA, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(valueX, javax.swing.GroupLayout.DEFAULT_SIZE, 18, Short.MAX_VALUE))))
.addComponent(labelINST)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(textBP4, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textBP3, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textBP2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textBP1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(valueINST, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelA)
.addComponent(valueA))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelX)
.addComponent(valueX, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelY)
.addComponent(valueY, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelSP)
.addComponent(valueSP))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelPC)
.addComponent(valuePC))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelPC1)
.addComponent(valuePC2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelINST)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueINST, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelBreakPoints, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textBP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textBP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textBP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textBP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelWatches)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textW1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueW1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textW2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueW2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textW3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueW3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textW4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueW4))
.addGap(6, 6, 6)
.addComponent(stepForwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enableDebug)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(enableTrace)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void enableDebugActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableDebugActionPerformed
EmulatorUILogic.enableDebug(enableDebug.isSelected());
}//GEN-LAST:event_enableDebugActionPerformed
private void stepForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepForwardButtonActionPerformed
EmulatorUILogic.stepForward();
}//GEN-LAST:event_stepForwardButtonActionPerformed
private void textBP1breakpointKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textBP1breakpointKeyPressed
EmulatorUILogic.updateBreakpointList(this);
}//GEN-LAST:event_textBP1breakpointKeyPressed
private void textBP2breakpointKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textBP2breakpointKeyPressed
EmulatorUILogic.updateBreakpointList(this);
}//GEN-LAST:event_textBP2breakpointKeyPressed
private void textBP3breakpointKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textBP3breakpointKeyPressed
EmulatorUILogic.updateBreakpointList(this);
}//GEN-LAST:event_textBP3breakpointKeyPressed
private void textBP4breakpointKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textBP4breakpointKeyPressed
EmulatorUILogic.updateBreakpointList(this);
}//GEN-LAST:event_textBP4breakpointKeyPressed
private void textW1watchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textW1watchKeyPressed
EmulatorUILogic.updateWatchList(this);
}//GEN-LAST:event_textW1watchKeyPressed
private void textW2watchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textW2watchKeyPressed
EmulatorUILogic.updateWatchList(this);
}//GEN-LAST:event_textW2watchKeyPressed
private void textW3watchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textW3watchKeyPressed
EmulatorUILogic.updateWatchList(this);
}//GEN-LAST:event_textW3watchKeyPressed
private void textW4watchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textW4watchKeyPressed
EmulatorUILogic.updateWatchList(this);
}//GEN-LAST:event_textW4watchKeyPressed
private void enableTraceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableTraceActionPerformed
EmulatorUILogic.enableTrace(enableTrace.isSelected());
}//GEN-LAST:event_enableTraceActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JCheckBox enableDebug;
public javax.swing.JCheckBox enableTrace;
private javax.swing.JLabel labelA;
private javax.swing.JLabel labelBreakPoints;
private javax.swing.JLabel labelINST;
private javax.swing.JLabel labelPC;
private javax.swing.JLabel labelPC1;
private javax.swing.JLabel labelSP;
private javax.swing.JLabel labelWatches;
private javax.swing.JLabel labelX;
private javax.swing.JLabel labelY;
private javax.swing.JButton stepForwardButton;
public javax.swing.JTextField textBP1;
public javax.swing.JTextField textBP2;
public javax.swing.JTextField textBP3;
public javax.swing.JTextField textBP4;
public javax.swing.JTextField textW1;
public javax.swing.JTextField textW2;
public javax.swing.JTextField textW3;
public javax.swing.JTextField textW4;
public javax.swing.JLabel valueA;
public javax.swing.JLabel valueINST;
public javax.swing.JLabel valuePC;
public javax.swing.JLabel valuePC2;
public javax.swing.JLabel valueSP;
public javax.swing.JLabel valueW1;
public javax.swing.JLabel valueW2;
public javax.swing.JLabel valueW3;
public javax.swing.JLabel valueW4;
public javax.swing.JLabel valueX;
public javax.swing.JLabel valueY;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Default Cursor"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="layers" alignment="0" pref="560" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="layers" alignment="0" pref="518" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JLayeredPane" name="layers">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="40" green="0" red="0" type="rgb"/>
</Property>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Container class="jace.ui.ScreenPanel" name="screen">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="0" width="560" height="520"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="560" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="520" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="jace.ui.DebuggerPanel" name="debuggerPanel">
<AuxValues>
<AuxValue name="JLayeredPane.layer" type="java.lang.Integer" value="200"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="460" y="0" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -1,290 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import jace.core.Computer;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* A newer take on the emulator window, providing a layered user interface for
* on-screen indicator icons. Created on Mar 27, 2010, 6:40:16 PM
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class EmulatorFrame extends AbstractEmulatorFrame {
@Override
public String getShortName() {
return "frame";
}
@Override
public DebuggerPanel getDebuggerPanel() {
return debuggerPanel;
}
@Override
public Component getScreen() {
return screen;
}
@Override
public void resizeVideo() {
super.resizeVideo();
layers.setLayer(screen, layers.lowestLayer());
layers.validate();
// On some systems (Ubuntu + Gnome 3) the screen layout gets messed up
// when toggling between fullscreen. This moves the screen back to the
// top of the window each time so that issue doesn't happen anymore.
screen.setLocation(screen.getLocation().x, 0);
}
public static final long serialVersionUID = -1100;
Font labelFont;
/**
* Creates new form EmulatorFrame
*/
public EmulatorFrame(Computer computer) {
setComputer(computer);
initComponents();
layers.setDoubleBuffered(true);
screen.setDoubleBuffered(true);
labelFont = Font.decode("Ubuntu-BOLD-14");
if (labelFont == null) {
labelFont = Font.decode("Arial-BOLD-14");
}
layers.setBounds(getContentPane().getBounds());
screen.setBounds(layers.getBounds());
debuggerPanel.setVisible(false);
layers.setPosition(screen, 10);
layers.setPosition(debuggerPanel, 2);
reconfigure();
screen.setFocusTraversalKeysEnabled(false);
}
@Override
public synchronized void addKeyListener(KeyListener l) {
super.addKeyListener(l);
layers.addKeyListener(l);
screen.addKeyListener(l);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
layers = new javax.swing.JLayeredPane();
screen = new jace.ui.ScreenPanel();
debuggerPanel = new jace.ui.DebuggerPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(0, 0, 0));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
layers.setBackground(new java.awt.Color(0, 0, 64));
layers.setOpaque(true);
javax.swing.GroupLayout screenLayout = new javax.swing.GroupLayout(screen);
screen.setLayout(screenLayout);
screenLayout.setHorizontalGroup(
screenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 560, Short.MAX_VALUE)
);
screenLayout.setVerticalGroup(
screenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 520, Short.MAX_VALUE)
);
screen.setBounds(0, 0, 560, 520);
layers.add(screen, javax.swing.JLayeredPane.DEFAULT_LAYER);
debuggerPanel.setBounds(460, 0, 100, 492);
layers.add(debuggerPanel, javax.swing.JLayeredPane.MODAL_LAYER);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(layers, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(layers, javax.swing.GroupLayout.DEFAULT_SIZE, 518, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(() -> {
new EmulatorFrame(null).setVisible(true);
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public jace.ui.DebuggerPanel debuggerPanel;
public javax.swing.JLayeredPane layers;
public jace.ui.ScreenPanel screen;
// End of variables declaration//GEN-END:variables
Set<JLabel> previousIndicators = new HashSet<>();
@Override
public void doRedrawIndicators(Set<ImageIcon> ind) {
synchronized (previousIndicators) {
previousIndicators.stream().map((l) -> {
l.setVisible(false);
return l;
}).forEach((l) -> {
layers.remove(l);
});
previousIndicators.clear();
}
if (ind != null && !ind.isEmpty()) {
int x = layers.getWidth();
int y = layers.getHeight();
for (ImageIcon i : visibleIndicators) {
JLabel label = createIndicatorIcon(i);
x -= (i.getIconWidth() + 10);
layers.add(label);
layers.setLayer(label, layers.highestLayer());
label.setBounds(x, y - i.getIconHeight() - 10, i.getIconWidth() + 5, i.getIconHeight() + 5);
if (x <= 80) {
x = layers.getWidth();
y -= 140;
}
synchronized (previousIndicators) {
previousIndicators.add(label);
}
label.setVisible(true);
}
} else {
if (computer != null && computer.video != null) {
computer.video.forceRefresh();
}
// This was causing a whole screen flicker -- bad.
// screen.repaint();
}
screen.requestFocusInWindow();
}
@Override
public void repaintIndicators() {
synchronized (previousIndicators) {
if (previousIndicators != null) {
previousIndicators.stream().forEach((l) -> {
Graphics g = l.getGraphics();
if (g != null) {
l.paint(g);
}
});
}
}
}
Map<ImageIcon, JLabel> indicatorCache = new HashMap<>();
private JLabel createIndicatorIcon(ImageIcon i) {
if (indicatorCache.containsKey(i)) {
return indicatorCache.get(i);
}
JLabel label = new OutlinedLabel(i.getDescription());
label.setIcon(i);
label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.CENTER);
label.setBackground(Color.BLACK);
label.setForeground(Color.WHITE);
label.setFont(labelFont);
label.setOpaque(false);
label.setFocusable(false);
label.setBounds(0, 0, i.getIconWidth(), i.getIconHeight());
BufferedImage img = new BufferedImage(i.getIconWidth(), i.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
label.paint(img.getGraphics());
ImageIcon icon = new ImageIcon(img);
JLabel renderedLabel = new JLabel(icon);
indicatorCache.put(i, renderedLabel);
return renderedLabel;
}
Map<String, JFrame> modals = new HashMap<>();
@Override
protected void displayModalDialog(final String name, JPanel ui, List<String> ancestors) {
final JFrame modal = modals.get(name);
if (modal != null) {
modal.setVisible(true);
modal.setState(Frame.NORMAL);
modal.toFront();
modal.requestFocus();
return;
}
JFrame frame = new JFrame();
modals.put(name, frame);
frame.addWindowStateListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
closeDialog(name);
}
});
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.setTitle(name);
frame.setContentPane(ui);
frame.setSize(ui.getPreferredSize());
frame.validate();
frame.setVisible(true);
}
@Override
protected void disposeModalDialog(String name) {
JFrame modal = modals.get(name);
if (modal != null) {
modals.remove(name);
modal.dispose();
}
modals.remove(name);
}
@Override
protected void hideModalDialog(String name) {
JFrame modal = modals.get(name);
if (modal != null) {
modal.setVisible(false);
}
}
}

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[560, 384]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="4"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="screen" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Component id="debuggerPanel" min="-2" pref="109" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="screen" max="32767" attributes="0"/>
<Component id="debuggerPanel" alignment="0" pref="504" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="jace.ui.DebuggerPanel" name="debuggerPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="java.awt.Canvas" name="screen">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new jace.ui.ScreenCanvas()"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@ -1,136 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import java.awt.Canvas;
import java.awt.Component;
import java.util.List;
import java.util.Set;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
* The old user interface. It is not capable of displaying on-screen indicators. Much of its logic was pulled out into the AbstractEmulatorFrame class.
* @author Administrator
*/
public class MainFrame extends AbstractEmulatorFrame {
@Override
public DebuggerPanel getDebuggerPanel() {
return debuggerPanel;
}
public MainFrame(JPanel debugger, JCheckBox enableDebug, JCheckBox enableTrace, JLabel labelA, JLabel labelBreakPoints, JLabel labelINST, JLabel labelPC, JLabel labelPC1, JLabel labelSP, JLabel labelWatches, JLabel labelX, JLabel labelY, Canvas screen, JButton stepForwardButton, JTextField textBP1, JTextField textBP2, JTextField textBP3, JTextField textBP4, JTextField textW1, JTextField textW2, JTextField textW3, JTextField textW4, JLabel valueA, JLabel valueINST, JLabel valuePC, JLabel valuePC2, JLabel valueSP, JLabel valueW1, JLabel valueW2, JLabel valueW3, JLabel valueW4, JLabel valueX, JLabel valueY) {
}
/**
* Creates new form MainFrame
*/
public MainFrame() {
initComponents();
reconfigure();
screen.setFocusTraversalKeysEnabled(false);
resizeVideo();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
debuggerPanel = new jace.ui.DebuggerPanel();
screen = new ScreenCanvas();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(560, 384));
screen.setPreferredSize(null);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(screen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(1, 1, 1)
.addComponent(debuggerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(screen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(debuggerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(() -> {
new MainFrame().setVisible(true);
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public jace.ui.DebuggerPanel debuggerPanel;
public java.awt.Canvas screen;
// End of variables declaration//GEN-END:variables
@Override
public String getShortName() {
return "frame";
}
@Override
public Component getScreen() {
return screen;
}
@Override
public void doRedrawIndicators(Set<ImageIcon> indicators) {
}
@Override
public void repaintIndicators() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected void displayModalDialog(String name, JPanel ui, List<String> ancestors) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
protected void disposeModalDialog(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
protected void hideModalDialog(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -1,81 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import javax.swing.Icon;
import javax.swing.JLabel;
/**
* This renders label text in white with a black outline around the letters for
* enhanced readability.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class OutlinedLabel extends JLabel {
public OutlinedLabel(Icon image) {
super(image);
}
public OutlinedLabel(String text) {
super(text);
}
public OutlinedLabel(Icon image, int horizontalAlignment) {
super(image, horizontalAlignment);
}
public OutlinedLabel(String text, int horizontalAlignment) {
super(text, horizontalAlignment);
}
public OutlinedLabel(String text, Icon icon, int horizontalAlignment) {
super(text, icon, horizontalAlignment);
}
@Override
public void paint(Graphics g) {
String text = getText();
Graphics2D gg = (Graphics2D) g;
int width = getWidth();
int height = getHeight();
// int width = g.getClipBounds().width;
// int height = g.getClipBounds().height;
TextLayout layout = new TextLayout(text, getFont(), ((Graphics2D) g).getFontRenderContext());
Shape shape = layout.getOutline(null);
getIcon().paintIcon(this, g, (int) ((width - getIcon().getIconWidth()) / 2), 0);
int x = (int) ((width - layout.getBounds().getWidth()) / 2);
int y = (int) (((height - layout.getBounds().getHeight() + layout.getAscent()) / 2) + layout.getDescent());
AffineTransform shift = AffineTransform.getTranslateInstance(x, y);
Shape shp = shift.createTransformedShape(shape);
gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
gg.setColor(getBackground());
gg.setStroke(new BasicStroke(3.0f));
gg.draw(shp);
gg.setColor(getForeground());
gg.fill(shp);
}
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import jace.Emulator;
import jace.core.Computer;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
/**
* Simple canvas with a navy blue background. Repaint requests are redirected to
* the video class.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class ScreenCanvas extends Canvas {
Computer computer;
public ScreenCanvas() {
setBackground(new Color(0, 0, 64));
setIgnoreRepaint(true);
}
public Computer getComputer() {
return Emulator.computer;
}
@Override
public void paint(Graphics g) {
if (getComputer() != null) {
getComputer().getVideo().forceRefresh();
}
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2012 Brendan Robert (BLuRry) brendan.robert@gmail.com.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package jace.ui;
import jace.Emulator;
import jace.core.Computer;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
* Simple panel which has a navy blue background and uses the video class to
* render its contents.
*
* @author Brendan Robert (BLuRry) brendan.robert@gmail.com
*/
public class ScreenPanel extends JPanel {
public ScreenPanel() {
setBackground(new Color(0, 0, 64));
setOpaque(false);
}
public Computer getComputer() {
return Emulator.computer;
}
@Override
public void paint(Graphics g) {
if (getComputer() != null) {
getComputer().getVideo().forceRefresh();
}
}
}