GUIMCMenu erstellt mit start, step, pause und reset button
This commit is contained in:
BIN
bin/View/GUIMCMenu.class
Normal file
BIN
bin/View/GUIMCMenu.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/View/GUIRamTable.class
Normal file
BIN
bin/View/GUIRamTable.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/View/GUIStack.class
Normal file
BIN
bin/View/GUIStack.class
Normal file
Binary file not shown.
Binary file not shown.
94
src/View/GUIMCMenu.java
Normal file
94
src/View/GUIMCMenu.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
|
||||
public class GUIMCMenu extends JPanel {
|
||||
/**
|
||||
* Color oWhite = new Color(255, 253, 250);
|
||||
* Color oDarkGray = new Color(76, 78, 82);
|
||||
* Color oDarkGrayB = new Color(47, 47, 47);
|
||||
* Color oLightBlue = new Color(173, 216, 230);
|
||||
* Color oOrangeDM = new Color(255, 170, 0);
|
||||
* Color oLightBlueDM = new Color(0, 213, 255);
|
||||
* Color oOrangeDMB = new Color(255, 85, 0);
|
||||
* First Color == TextColor
|
||||
* Second Color == BackgroundColor
|
||||
* Third Color == BorderColor
|
||||
* Fourth Color == TextColor Marked
|
||||
* Fifth Color == BackgroundColor Marked
|
||||
* Sixth Color == BorderColor Marked
|
||||
*/
|
||||
Color[] aoDarkTheme = {new Color(255, 253, 250), new Color(76, 78, 82), new Color(47, 47, 47), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
Color[] aoLightTheme = {new Color(76, 78, 82), new Color(255, 253, 250), new Color(173, 216, 230), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
|
||||
JButton oButtonStart = new JButton();
|
||||
JButton oButtonStep = new JButton();
|
||||
JButton oButtonPause = new JButton();
|
||||
JButton oButtonReset = new JButton();
|
||||
|
||||
ArrayList<JButton> oButtons = new ArrayList<JButton>();
|
||||
|
||||
public GUIMCMenu() {
|
||||
buildGUIMCMenu();
|
||||
fillList();
|
||||
}
|
||||
|
||||
private void buildGUIMCMenu() {
|
||||
GridBagConstraints oConstraints = new GridBagConstraints();
|
||||
this.setLayout(new GridBagLayout());
|
||||
oConstraints.gridx = 0;
|
||||
oConstraints.gridy = 0;
|
||||
oConstraints.insets = new Insets(2, 0, 2, 0);
|
||||
oConstraints.anchor = GridBagConstraints.WEST;
|
||||
this.add(oButtonStart, oConstraints);
|
||||
oConstraints.gridy = 1;
|
||||
this.add(oButtonStep, oConstraints);
|
||||
oConstraints.gridy = 2;
|
||||
this.add(oButtonPause, oConstraints);
|
||||
}
|
||||
|
||||
private void fillList() {
|
||||
oButtons.add(oButtonStart);
|
||||
oButtons.add(oButtonStep);
|
||||
oButtons.add(oButtonPause);
|
||||
oButtons.add(oButtonReset);
|
||||
}
|
||||
|
||||
public ArrayList<JButton> getControlButtons() {
|
||||
return oButtons;
|
||||
}
|
||||
|
||||
public void setTheme(int iThemeNr) {
|
||||
switch (iThemeNr) {
|
||||
case 0: {
|
||||
for (JButton oButton : oButtons) {
|
||||
oButton.setForeground(aoLightTheme[0]);
|
||||
oButton.setBackground(aoLightTheme[1]);
|
||||
oButton.setBorder(BorderFactory.createLineBorder(aoLightTheme[2]));
|
||||
}
|
||||
this.setForeground(aoLightTheme[0]);
|
||||
this.setBackground(aoLightTheme[1]);
|
||||
this.setBorder(BorderFactory.createLineBorder(aoLightTheme[2]));
|
||||
}break;
|
||||
case 1: {
|
||||
for (JButton oButton : oButtons) {
|
||||
oButton.setForeground(aoDarkTheme[0]);
|
||||
oButton.setBackground(aoDarkTheme[1]);
|
||||
oButton.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2]));
|
||||
}
|
||||
this.setForeground(aoDarkTheme[0]);
|
||||
this.setBackground(aoDarkTheme[1]);
|
||||
this.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2]));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener {
|
||||
GUIRegister oGUIRegister;
|
||||
GUIRegistersDetailed oGUIRegistersDetailed;
|
||||
|
||||
ArrayList<JCheckBox> oCheckBoxes;
|
||||
ArrayList<JCheckBox> oBreakpoints;
|
||||
ReadEepromFile oRef;
|
||||
boolean[] bBreakpointSet;
|
||||
int iTestFileLoaded = 0;
|
||||
@@ -546,22 +546,23 @@ public class GUIMenuBar extends JMenuBar implements ActionListener {
|
||||
oRef.setData(oFile);
|
||||
oRef.setOPCode(oRef.getData());
|
||||
oGUITestFileTable.setData(oRef.getData());
|
||||
|
||||
ArrayList<String> data = oRef.getData();
|
||||
int iDataSize = data.size();
|
||||
ArrayList<String> opcode = oRef.getOPCode();
|
||||
int iOPCodeSize = opcode.size();
|
||||
if (iTestFileLoaded > 0) {
|
||||
oCheckBoxes = oGUITestFileTable.getCheckboxes();
|
||||
oBreakpoints = oGUITestFileTable.getCheckboxes();
|
||||
for (int i = 0; i < iDataSize; i++) {
|
||||
oCheckBoxes.get(i).setEnabled(false);
|
||||
oBreakpoints.get(i).setEnabled(false);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < iDataSize; i++) {
|
||||
for (int j = 0; j < iOPCodeSize; j++) {
|
||||
if (data.get(i).equals(opcode.get(j))) {
|
||||
oCheckBoxes = oGUITestFileTable.getCheckboxes();
|
||||
oCheckBoxes.get(i).setEnabled(true);
|
||||
oCheckBoxes.get(i).addActionListener(this);
|
||||
oBreakpoints = oGUITestFileTable.getCheckboxes();
|
||||
oBreakpoints.get(i).setEnabled(true);
|
||||
oBreakpoints.get(i).addActionListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,8 +577,8 @@ public class GUIMenuBar extends JMenuBar implements ActionListener {
|
||||
if (oRef != null) {
|
||||
int iOPCode = oRef.getOPCode().size();
|
||||
if (iOPCode > 0) {
|
||||
for (int i = 0; i < oCheckBoxes.size(); i++) {
|
||||
if (e.getSource() == oCheckBoxes.get(i)) {
|
||||
for (int i = 0; i < oBreakpoints.size(); i++) {
|
||||
if (e.getSource() == oBreakpoints.get(i)) {
|
||||
for (int j = 0; j < iOPCode; j++) {
|
||||
if (oRef.getOPCode().get(j).equals(oRef.getData().get(i))) {
|
||||
bBreakpointSet[j] = !bBreakpointSet[j];
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
package View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class GUIPorts extends JPanel {
|
||||
|
||||
/**
|
||||
* Color oWhite = new Color(255, 253, 250);
|
||||
* Color oDarkGray = new Color(76, 78, 82);
|
||||
* Color oDarkGrayB = new Color(47, 47, 47);
|
||||
* Color oLightBlue = new Color(173, 216, 230);
|
||||
* Color oOrangeDM = new Color(255, 170, 0);
|
||||
* Color oLightBlueDM = new Color(0, 213, 255);
|
||||
* Color oOrangeDMB = new Color(255, 85, 0);
|
||||
* First Color == TextColor
|
||||
* Second Color == BackgroundColor
|
||||
* Third Color == BorderColor
|
||||
* Fourth Color == TextColor Marked
|
||||
* Fifth Color == BackgroundColor Marked
|
||||
* Sixth Color == BorderColor Marked
|
||||
*/
|
||||
Color[] aoDarkTheme = {new Color(255, 253, 250), new Color(76, 78, 82), new Color(47, 47, 47), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
Color[] aoLightTheme = {new Color(76, 78, 82), new Color(255, 253, 250), new Color(173, 216, 230), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
|
||||
JPanel oPanelPortA = new JPanel();
|
||||
JPanel oPanelPortB = new JPanel();
|
||||
|
||||
@@ -24,38 +45,46 @@ public class GUIPorts extends JPanel {
|
||||
JLabel oPinA = new JLabel("Pin");
|
||||
JLabel oPinB = new JLabel("Pin");
|
||||
|
||||
JCheckBox oRA4 = new JCheckBox("RA4");
|
||||
JCheckBox oRA3 = new JCheckBox("RA3");
|
||||
JCheckBox oRA2 = new JCheckBox("RA2");
|
||||
JCheckBox oRA1 = new JCheckBox("RA1");
|
||||
JCheckBox oRA0 = new JCheckBox("RA0");
|
||||
JCheckBox oRA4 = new JCheckBox("4");
|
||||
JCheckBox oRA3 = new JCheckBox("3");
|
||||
JCheckBox oRA2 = new JCheckBox("2");
|
||||
JCheckBox oRA1 = new JCheckBox("1");
|
||||
JCheckBox oRA0 = new JCheckBox("0");
|
||||
|
||||
JCheckBox oTRISA4 = new JCheckBox("TRISA4");
|
||||
JCheckBox oTRISA3 = new JCheckBox("TRISA3");
|
||||
JCheckBox oTRISA2 = new JCheckBox("TRISA2");
|
||||
JCheckBox oTRISA1 = new JCheckBox("TRISA1");
|
||||
JCheckBox oTRISA0 = new JCheckBox("TRISA0");
|
||||
JCheckBox oTRISA4 = new JCheckBox("4");
|
||||
JCheckBox oTRISA3 = new JCheckBox("3");
|
||||
JCheckBox oTRISA2 = new JCheckBox("2");
|
||||
JCheckBox oTRISA1 = new JCheckBox("1");
|
||||
JCheckBox oTRISA0 = new JCheckBox("0");
|
||||
|
||||
JCheckBox oRB7 = new JCheckBox("RB7");
|
||||
JCheckBox oRB6 = new JCheckBox("RB6");
|
||||
JCheckBox oRB5 = new JCheckBox("RB5");
|
||||
JCheckBox oRB4 = new JCheckBox("RB4");
|
||||
JCheckBox oRB3 = new JCheckBox("RB3");
|
||||
JCheckBox oRB2 = new JCheckBox("RB2");
|
||||
JCheckBox oRB1 = new JCheckBox("RB1");
|
||||
JCheckBox oRB0 = new JCheckBox("RB0");
|
||||
JCheckBox oRB7 = new JCheckBox("7");
|
||||
JCheckBox oRB6 = new JCheckBox("6");
|
||||
JCheckBox oRB5 = new JCheckBox("5");
|
||||
JCheckBox oRB4 = new JCheckBox("4");
|
||||
JCheckBox oRB3 = new JCheckBox("3");
|
||||
JCheckBox oRB2 = new JCheckBox("2");
|
||||
JCheckBox oRB1 = new JCheckBox("1");
|
||||
JCheckBox oRB0 = new JCheckBox("0");
|
||||
|
||||
JCheckBox oTRISB7 = new JCheckBox("TRISB7");
|
||||
JCheckBox oTRISB6 = new JCheckBox("TRISB6");
|
||||
JCheckBox oTRISB5 = new JCheckBox("TRISB5");
|
||||
JCheckBox oTRISB4 = new JCheckBox("TRISB4");
|
||||
JCheckBox oTRISB3 = new JCheckBox("TRISB3");
|
||||
JCheckBox oTRISB2 = new JCheckBox("TRISB2");
|
||||
JCheckBox oTRISB1 = new JCheckBox("TRISB1");
|
||||
JCheckBox oTRISB0 = new JCheckBox("TRISB0");
|
||||
JCheckBox oTRISB7 = new JCheckBox("7");
|
||||
JCheckBox oTRISB6 = new JCheckBox("6");
|
||||
JCheckBox oTRISB5 = new JCheckBox("5");
|
||||
JCheckBox oTRISB4 = new JCheckBox("4");
|
||||
JCheckBox oTRISB3 = new JCheckBox("3");
|
||||
JCheckBox oTRISB2 = new JCheckBox("2");
|
||||
JCheckBox oTRISB1 = new JCheckBox("1");
|
||||
JCheckBox oTRISB0 = new JCheckBox("0");
|
||||
|
||||
ArrayList<JCheckBox> oCheckboxes = new ArrayList<JCheckBox>();
|
||||
ArrayList<JLabel> oLabels = new ArrayList<JLabel>();
|
||||
ArrayList<JPanel> oPanels = new ArrayList<JPanel>();
|
||||
|
||||
boolean bCheckboxesInit = false;
|
||||
|
||||
public GUIPorts() {
|
||||
buildGUIPorts();
|
||||
fillLists();
|
||||
setTheme(0);
|
||||
}
|
||||
|
||||
private void buildGUIPorts() {
|
||||
@@ -104,7 +133,7 @@ public class GUIPorts extends JPanel {
|
||||
oPanelPortA.add(oPanelPortAPins, oConstraints);
|
||||
oConstraints.gridx = 0;
|
||||
oConstraints.gridy = 2;
|
||||
oPanelPortA.add(oTrisA);
|
||||
oPanelPortA.add(oTrisA, oConstraints);
|
||||
oConstraints.gridx = 1;
|
||||
oPanelPortA.add(oPanelPortATris, oConstraints);
|
||||
|
||||
@@ -117,7 +146,7 @@ public class GUIPorts extends JPanel {
|
||||
oPanelPortB.add(oPanelPortBPins, oConstraints);
|
||||
oConstraints.gridx = 0;
|
||||
oConstraints.gridy = 2;
|
||||
oPanelPortB.add(oTrisB);
|
||||
oPanelPortB.add(oTrisB, oConstraints);
|
||||
oConstraints.gridx = 1;
|
||||
oPanelPortB.add(oPanelPortBTris, oConstraints);
|
||||
|
||||
@@ -129,4 +158,99 @@ public class GUIPorts extends JPanel {
|
||||
oConstraints.gridy = 1;
|
||||
this.add(oPanelPortB, oConstraints);
|
||||
}
|
||||
|
||||
private void fillLists() {
|
||||
oPanels.add(oPanelPortA);
|
||||
oPanels.add(oPanelPortAPins);
|
||||
oPanels.add(oPanelPortATris);
|
||||
oPanels.add(oPanelPortB);
|
||||
oPanels.add(oPanelPortBPins);
|
||||
oPanels.add(oPanelPortBTris);
|
||||
oPanels.add(this);
|
||||
|
||||
oLabels.add(oPortA);
|
||||
oLabels.add(oPinA);
|
||||
oLabels.add(oTrisA);
|
||||
oLabels.add(oPortB);
|
||||
oLabels.add(oPinB);
|
||||
oLabels.add(oTrisB);
|
||||
|
||||
oCheckboxes.add(oRA0);
|
||||
oCheckboxes.add(oRA1);
|
||||
oCheckboxes.add(oRA2);
|
||||
oCheckboxes.add(oRA3);
|
||||
oCheckboxes.add(oRA4);
|
||||
|
||||
oCheckboxes.add(oTRISA0);
|
||||
oCheckboxes.add(oTRISA1);
|
||||
oCheckboxes.add(oTRISA2);
|
||||
oCheckboxes.add(oTRISA3);
|
||||
oCheckboxes.add(oTRISA4);
|
||||
|
||||
oCheckboxes.add(oRB0);
|
||||
oCheckboxes.add(oRB1);
|
||||
oCheckboxes.add(oRB2);
|
||||
oCheckboxes.add(oRB3);
|
||||
oCheckboxes.add(oRB4);
|
||||
oCheckboxes.add(oRB5);
|
||||
oCheckboxes.add(oRB6);
|
||||
oCheckboxes.add(oRB7);
|
||||
|
||||
oCheckboxes.add(oTRISB0);
|
||||
oCheckboxes.add(oTRISB1);
|
||||
oCheckboxes.add(oTRISB2);
|
||||
oCheckboxes.add(oTRISB3);
|
||||
oCheckboxes.add(oTRISB4);
|
||||
oCheckboxes.add(oTRISB5);
|
||||
oCheckboxes.add(oTRISB6);
|
||||
oCheckboxes.add(oTRISB7);
|
||||
|
||||
bCheckboxesInit = true;
|
||||
}
|
||||
|
||||
public ArrayList<JCheckBox> getPorts() {
|
||||
if (bCheckboxesInit)
|
||||
return oCheckboxes;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setTheme(int iThemeNr) {
|
||||
switch (iThemeNr) {
|
||||
case 0: {
|
||||
for (JPanel oPanel : oPanels) {
|
||||
oPanel.setForeground(aoLightTheme[0]);
|
||||
oPanel.setBackground(aoLightTheme[1]);
|
||||
}
|
||||
for (JLabel oLabel : oLabels) {
|
||||
oLabel.setForeground(aoLightTheme[0]);
|
||||
oLabel.setBackground(aoLightTheme[1]);
|
||||
}
|
||||
for (JCheckBox oCheckBox : oCheckboxes) {
|
||||
oCheckBox.setForeground(aoLightTheme[0]);
|
||||
oCheckBox.setBackground(aoLightTheme[1]);
|
||||
oCheckBox.setBorder(BorderFactory.createLineBorder(aoLightTheme[2]));
|
||||
}
|
||||
oPanelPortB.setBorder(BorderFactory.createLineBorder(aoLightTheme[2]));
|
||||
this.setBorder(BorderFactory.createLineBorder(aoLightTheme[2], 2));
|
||||
}break;
|
||||
case 1: {
|
||||
for (JPanel oPanel : oPanels) {
|
||||
oPanel.setForeground(aoDarkTheme[0]);
|
||||
oPanel.setBackground(aoDarkTheme[1]);
|
||||
}
|
||||
for (JLabel oLabel : oLabels) {
|
||||
oLabel.setForeground(aoDarkTheme[0]);
|
||||
oLabel.setBackground(aoDarkTheme[1]);
|
||||
}
|
||||
for (JCheckBox oCheckBox : oCheckboxes) {
|
||||
oCheckBox.setForeground(aoDarkTheme[0]);
|
||||
oCheckBox.setBackground(aoDarkTheme[1]);
|
||||
oCheckBox.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2]));
|
||||
}
|
||||
oPanelPortB.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2]));
|
||||
this.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2], 2));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
src/View/GUIRamTable.java
Normal file
39
src/View/GUIRamTable.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package View;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class GUIRamTable extends JPanel {
|
||||
/**
|
||||
* Color oWhite = new Color(255, 253, 250);
|
||||
* Color oDarkGray = new Color(76, 78, 82);
|
||||
* Color oDarkGrayB = new Color(47, 47, 47);
|
||||
* Color oLightBlue = new Color(173, 216, 230);
|
||||
* Color oOrangeDM = new Color(255, 170, 0);
|
||||
* Color oLightBlueDM = new Color(0, 213, 255);
|
||||
* Color oOrangeDMB = new Color(255, 85, 0);
|
||||
* First Color == TextColor
|
||||
* Second Color == BackgroundColor
|
||||
* Third Color == BorderColor
|
||||
* Fourth Color == TextColor Marked
|
||||
* Fifth Color == BackgroundColor Marked
|
||||
* Sixth Color == BorderColor Marked
|
||||
*/
|
||||
Color[] aoDarkTheme = {new Color(255, 253, 250), new Color(76, 78, 82), new Color(47, 47, 47), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
Color[] aoLightTheme = {new Color(76, 78, 82), new Color(255, 253, 250), new Color(173, 216, 230), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
|
||||
String[][] assData = {{}};
|
||||
String[] asHeaders = {};
|
||||
JTable oRamTable = new JTable();
|
||||
|
||||
JScrollPane oScrollPane = new JScrollPane();
|
||||
|
||||
public GUIRamTable() {
|
||||
oScrollPane.setPreferredSize(new Dimension(400, 350));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,6 +99,47 @@ public class GUIRegister extends JPanel {
|
||||
this.add(oPanelSFR, oConstraints);
|
||||
oConstraints.gridy = 1;
|
||||
this.add(oPanelW, oConstraints);
|
||||
|
||||
oSFRRegisters.setEnabled(false);
|
||||
oWRegister.setEnabled(false);
|
||||
}
|
||||
|
||||
public void setRegisters(int[] aiRegisters) {
|
||||
/* TMR0
|
||||
PC intern
|
||||
STATUS
|
||||
PCLATH
|
||||
FSR
|
||||
PCL
|
||||
OPTION
|
||||
Prescaler
|
||||
W-Register
|
||||
Size of array has to be 9.
|
||||
*/
|
||||
//String[][] asDataSFR = {{"TMR0", "0", "PC intern", "0"}, {"STATUS", "0", "PCLATH", "0"}, {"FSR", "0", "PCL", "0"}, {"OPTION", "0", "Prescaler", "0"}};
|
||||
//String[][] asDataW = {{"W-Register", "0", "", ""}};
|
||||
|
||||
String sTMR0 = aiRegisters[0] + "";
|
||||
String sPCIntern = aiRegisters[1] + "";
|
||||
String sSTATUS = aiRegisters[2] + "";
|
||||
String sPCLATH = aiRegisters[3] + "";
|
||||
String sFSR = aiRegisters[4] + "";
|
||||
String sPCL = aiRegisters[5] + "";
|
||||
String sOPTION = aiRegisters[6] + "";
|
||||
String sPrescaler = aiRegisters[7] + "";
|
||||
|
||||
String sWRegister = aiRegisters[8] + "";
|
||||
|
||||
oSFRRegisters.setValueAt(sTMR0, 0, 1);
|
||||
oSFRRegisters.setValueAt(sPCIntern, 0, 3);
|
||||
oSFRRegisters.setValueAt(sSTATUS, 1, 1);
|
||||
oSFRRegisters.setValueAt(sPCLATH, 1, 3);
|
||||
oSFRRegisters.setValueAt(sFSR, 2, 1);
|
||||
oSFRRegisters.setValueAt(sPCL, 2, 3);
|
||||
oSFRRegisters.setValueAt(sOPTION, 3, 1);
|
||||
oSFRRegisters.setValueAt(sPrescaler, 3, 3);
|
||||
|
||||
oWRegister.setValueAt(sWRegister, 0, 1);
|
||||
}
|
||||
|
||||
private void setWidth() {
|
||||
|
||||
100
src/View/GUIStack.java
Normal file
100
src/View/GUIStack.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package View;
|
||||
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
|
||||
public class GUIStack extends JPanel {
|
||||
/**
|
||||
* Color oWhite = new Color(255, 253, 250);
|
||||
* Color oDarkGray = new Color(76, 78, 82);
|
||||
* Color oDarkGrayB = new Color(47, 47, 47);
|
||||
* Color oLightBlue = new Color(173, 216, 230);
|
||||
* Color oOrangeDM = new Color(255, 170, 0);
|
||||
* Color oLightBlueDM = new Color(0, 213, 255);
|
||||
* Color oOrangeDMB = new Color(255, 85, 0);
|
||||
* First Color == TextColor
|
||||
* Second Color == BackgroundColor
|
||||
* Third Color == BorderColor
|
||||
* Fourth Color == TextColor Marked
|
||||
* Fifth Color == BackgroundColor Marked
|
||||
* Sixth Color == BorderColor Marked
|
||||
*/
|
||||
Color[] aoDarkTheme = {new Color(255, 253, 250), new Color(76, 78, 82), new Color(47, 47, 47), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
Color[] aoLightTheme = {new Color(76, 78, 82), new Color(255, 253, 250), new Color(173, 216, 230), new Color(0, 213, 255), new Color(255, 170, 0), new Color(255, 85, 0)};
|
||||
|
||||
JLabel oStackLabel = new JLabel("Stack");
|
||||
|
||||
String[][] asData = {{"0"}, {"0"}, {"0"}, {"0"}, {"0"}, {"0"}, {"0"}, {"0"}};
|
||||
String[] asHeaders = {"0"};
|
||||
JTable oStackTable = new JTable(asData, asHeaders);
|
||||
|
||||
public GUIStack() {
|
||||
buildGUIStack();
|
||||
setTheme(0);
|
||||
}
|
||||
|
||||
private void buildGUIStack() {
|
||||
GridBagConstraints oConstraints = new GridBagConstraints();
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
oConstraints.gridx = 0;
|
||||
oConstraints.gridy = 0;
|
||||
oConstraints.anchor = GridBagConstraints.WEST;
|
||||
this.add(oStackLabel, oConstraints);
|
||||
oConstraints.gridy = 1;
|
||||
this.add(oStackTable, oConstraints);
|
||||
}
|
||||
|
||||
public void setTheme(int iThemeNr) {
|
||||
switch (iThemeNr) {
|
||||
case 0: {
|
||||
oStackLabel.setForeground(aoLightTheme[0]);
|
||||
oStackLabel.setBackground(aoLightTheme[1]);
|
||||
oStackTable.setForeground(aoLightTheme[0]);
|
||||
oStackTable.setBackground(aoLightTheme[1]);
|
||||
oStackTable.setGridColor(aoLightTheme[2]);
|
||||
this.setForeground(aoLightTheme[0]);
|
||||
this.setBackground(aoLightTheme[1]);
|
||||
this.setBorder(BorderFactory.createLineBorder(aoLightTheme[2], 2));
|
||||
}break;
|
||||
case 1: {
|
||||
oStackLabel.setForeground(aoDarkTheme[0]);
|
||||
oStackLabel.setBackground(aoDarkTheme[1]);
|
||||
oStackTable.setForeground(aoDarkTheme[0]);
|
||||
oStackTable.setBackground(aoDarkTheme[1]);
|
||||
oStackTable.setGridColor(aoDarkTheme[2]);
|
||||
this.setForeground(aoDarkTheme[0]);
|
||||
this.setBackground(aoDarkTheme[1]);
|
||||
this.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2], 2));
|
||||
}break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setStack(int[] aiStack) {
|
||||
String s0 = aiStack[0] + "";
|
||||
String s1 = aiStack[1] + "";
|
||||
String s2 = aiStack[2] + "";
|
||||
String s3 = aiStack[3] + "";
|
||||
String s4 = aiStack[4] + "";
|
||||
String s5 = aiStack[5] + "";
|
||||
String s6 = aiStack[6] + "";
|
||||
String s7 = aiStack[7] + "";
|
||||
|
||||
oStackTable.setValueAt(s0, 0, 0);
|
||||
oStackTable.setValueAt(s1, 1, 0);
|
||||
oStackTable.setValueAt(s2, 2, 0);
|
||||
oStackTable.setValueAt(s3, 3, 0);
|
||||
oStackTable.setValueAt(s4, 4, 0);
|
||||
oStackTable.setValueAt(s5, 5, 0);
|
||||
oStackTable.setValueAt(s6, 6, 0);
|
||||
oStackTable.setValueAt(s7, 7, 0);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class GUITestFileTable extends JScrollPane {
|
||||
ArrayList<JTextField> oLineInformation = new ArrayList<JTextField>();
|
||||
ArrayList<JCheckBox> oCheckboxes = new ArrayList<JCheckBox>();
|
||||
ArrayList<JPanel> oPanels = new ArrayList<JPanel>();
|
||||
JPanel oTable;
|
||||
JPanel oTable = new JPanel();
|
||||
int iTheme = 0;
|
||||
boolean bFileLoaded = false;
|
||||
|
||||
@@ -45,29 +45,18 @@ public class GUITestFileTable extends JScrollPane {
|
||||
* Constructor which initializes a filler.
|
||||
*/
|
||||
public GUITestFileTable() {
|
||||
oTable = new JPanel();
|
||||
|
||||
JPanel oTestPanel = new JPanel();
|
||||
|
||||
JTextField oFill = new JTextField("0");
|
||||
oLineInformation.add(oFill);
|
||||
JTextField oFill = new JTextField("Please load testfile!");
|
||||
oFill.setEditable(false);
|
||||
oLineInformation.add(oFill);
|
||||
|
||||
JPanel oTestPanel = new JPanel();
|
||||
oTestPanel.setLayout(new GridLayout(1, 3));
|
||||
oTestPanel.add(oFill);
|
||||
|
||||
JCheckBox oCheckbox = new JCheckBox();
|
||||
JPanel oCheckBoxPanel = new JPanel();
|
||||
oCheckBoxPanel.add(oCheckbox);
|
||||
oPanels.add(oCheckBoxPanel);
|
||||
oTestPanel.add(oCheckBoxPanel);
|
||||
oCheckboxes.add(oCheckbox);
|
||||
oFill = new JTextField("Please load testfile!");
|
||||
oFill.setEditable(false);
|
||||
oLineInformation.add(oFill);
|
||||
oTestPanel.add(oFill);
|
||||
|
||||
this.setPreferredSize(new Dimension(600, 700));
|
||||
this.setViewportView(oTestPanel);
|
||||
setTheme(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,6 @@ public class MyView {
|
||||
JPanel oGUIMainPanel;
|
||||
|
||||
public MyView() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user