diff --git a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.class b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.class index db1d228..e1aab4c 100644 Binary files a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.class and b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.class differ diff --git a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.class b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.class index 39fcbfa..c4349c6 100644 Binary files a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.class and b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.class differ diff --git a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.class b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.class new file mode 100644 index 0000000..511e298 Binary files /dev/null and b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.class differ diff --git a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.class b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.class deleted file mode 100644 index 0b92a19..0000000 Binary files a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.class and /dev/null differ diff --git a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.class b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.class index 43ec6c5..1c48f95 100644 Binary files a/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.class and b/bin/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.class differ diff --git a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.java b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.java index ce6f4c3..957614a 100755 --- a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.java +++ b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMainFrame.java @@ -1,7 +1,6 @@ package View.PIC_SIMULATOR_GUI_JAVA; import java.awt.Color; -import java.awt.Dimension; import java.awt.Insets; import java.util.ArrayList; import java.awt.GridBagLayout; @@ -9,12 +8,9 @@ import java.awt.GridBagConstraints; import javax.swing.BorderFactory; import javax.swing.ImageIcon; -import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; -import javax.swing.border.Border; -import Model.Backend.EepromLoader.ReadEepromFile; import Model.Backend.Runtime.Environment; public class GUIMainFrame extends JFrame { @@ -65,23 +61,24 @@ public class GUIMainFrame extends JFrame { iPrescaler = env.getPIC().getRam().get_WDT_PrescalerRate(); else iPrescaler = env.getPIC().getRam().get_TMR0_PrescalerRate(); - int[] aiRegisters = {env.getPIC().getRam().get_PCL(), env.getPIC().getRam().get_PCLATH(), + /*int[] aiRegisters = {env.getPIC().getRam().get_PCL(), env.getPIC().getRam().get_PCLATH(), env.getPIC().getRam().get_Programcounter(), env.getPIC().getRam().get_STATUS(), env.getPIC().getRam().get_FSR(), env.getPIC().getRam().get_OPTION(), iPrescaler, env.getPIC().getRam().get_TMR0(), - env.getPIC().get_WRegister()}; - GUIRegisters oGUIRegisters = new GUIRegisters(); - oGUIRegisters.setRegisters(aiRegisters); + env.getPIC().get_WRegister()};*/ + GUIRegister oGUIRegister = new GUIRegister(); + //oGUIRegisters.setRegisters(aiRegisters); GUIRegistersDetailed oGUIRegistersDetailed = new GUIRegistersDetailed(); - oConstraintsRegisterInformation.anchor = GridBagConstraints.WEST; + oConstraintsRegisterInformation.anchor = GridBagConstraints.NORTHWEST; oConstraintsRegisterInformation.gridx = 0; oConstraintsRegisterInformation.gridy = 0; - oPanelRegisterInformation.add(oGUIRegisters, oConstraintsRegisterInformation); + oConstraintsRegisterInformation.insets = new Insets(10, 0, 10, 0); + oPanelRegisterInformation.add(oGUIRegister, oConstraintsRegisterInformation); oConstraintsRegisterInformation.gridy = 1; oConstraintsRegisterInformation.anchor = GridBagConstraints.WEST; oPanelRegisterInformation.add(oGUIRegistersDetailed, oConstraintsRegisterInformation); - this.setJMenuBar(new GUIMenuBar(env, this, oGUITestFileTable, oGUIRegisters, oGUIRegistersDetailed)); + this.setJMenuBar(new GUIMenuBar(env, this, oGUITestFileTable, oGUIRegister, oGUIRegistersDetailed)); this.setVisible(true); //make frame visible ImageIcon guiLogo = new ImageIcon("./pictures/gui_logo.png"); // create an ImageIcon diff --git a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.java b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.java index a6a18a9..129aed3 100644 --- a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.java +++ b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIMenuBar.java @@ -14,7 +14,6 @@ import javax.swing.JFileChooser; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; -import javax.swing.JPanel; import Model.Backend.EepromLoader.ReadEepromFile; import Model.Backend.Runtime.Environment; @@ -23,7 +22,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener { Environment oEnv; GUIMainFrame oGUIMainFrame; GUITestFileTable oGUITestFileTable; - GUIRegisters oGUIRegisters; + GUIRegister oGUIRegister; GUIRegistersDetailed oGUIRegistersDetailed; ArrayList oCheckBoxes; @@ -97,7 +96,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener { * Constructor initializes menubar. * @param frame */ - public GUIMenuBar(Environment env, GUIMainFrame mainframe, GUITestFileTable guitft, GUIRegisters guiregs, GUIRegistersDetailed guiregsdet) { //TODO maybe single components, with methods, of frame to set theme + public GUIMenuBar(Environment env, GUIMainFrame mainframe, GUITestFileTable guitft, GUIRegister guiregs, GUIRegistersDetailed guiregsdet) { //TODO maybe single components, with methods, of frame to set theme //Custom Separators since default is not able to change background. oSeparator0 = new JMenuItem(); @@ -117,7 +116,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener { oEnv = env; oGUIMainFrame = mainframe; oGUITestFileTable = guitft; - oGUIRegisters = guiregs; + oGUIRegister = guiregs; oGUIRegistersDetailed = guiregsdet; //File @@ -370,7 +369,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener { System.out.println("It's gettin dark brooo"); //TODO setTheme(aoDarkTheme[0], aoDarkTheme[1]); oGUITestFileTable.setTheme(1); - oGUIRegisters.setTheme(1); + oGUIRegister.setTheme(1); oGUIMainFrame.setTheme(1); oGUIRegistersDetailed.setTheme(1); } @@ -379,7 +378,7 @@ public class GUIMenuBar extends JMenuBar implements ActionListener { System.out.println("Death to all vampires!"); //TODO setTheme(aoLightTheme[0], aoLightTheme[1]); oGUITestFileTable.setTheme(0); - oGUIRegisters.setTheme(0); + oGUIRegister.setTheme(0); oGUIMainFrame.setTheme(0); oGUIRegistersDetailed.setTheme(0); } diff --git a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.java b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.java new file mode 100644 index 0000000..e322489 --- /dev/null +++ b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegister.java @@ -0,0 +1,153 @@ +package View.PIC_SIMULATOR_GUI_JAVA; + +import java.util.ArrayList; + +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Color; + +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.BorderFactory; +import javax.swing.JLabel; + +public class GUIRegister 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 oSFR = new JLabel("SFR"); + JLabel oW = new JLabel("W"); + + /*JTextField oTextPCL = new JTextField("PCL", iTextFieldSize); + JTextField oTextPCLATH = new JTextField("PCLATH", iTextFieldSize); + JTextField oTextPCIntern = new JTextField("PC intern", iTextFieldSize); + JTextField oTextStatus = new JTextField("STATUS", iTextFieldSize); + JTextField oTextFileSelectionRegister = new JTextField("FileSelectionRegister", iTextFieldSize); + JTextField oTextOption = new JTextField("OPTION", iTextFieldSize); + JTextField oTextPrescaler = new JTextField("Prescaler", iTextFieldSize); + JTextField oTextTMR0 = new JTextField("TMR0", iTextFieldSize);*/ + + String[][] asDataSFR = {{"TMR0", "0", "PC intern", "0"}, {"STATUS", "0", "PCLATH", "0"}, {"FSR", "0", "PCL", "0"}, {"OPTION", "0", "Prescaler", "0"}}; + String[] asHeadersSFR = {"0", "1", "2", "3"}; + + String[][] asDataW = {{"W-Register", "0", "", ""}}; + String[] asHeadersW = {"0", "1", "2", "3"}; + + JTable oSFRRegisters = new JTable(asDataSFR, asHeadersSFR); + JTable oWRegister = new JTable(asDataW, asHeadersW); + + JPanel oPanelSFR = new JPanel(); + JPanel oPanelW = new JPanel(); + + ArrayList oLabels = new ArrayList(); + ArrayList oTables = new ArrayList(); + ArrayList oPanels = new ArrayList(); + + public GUIRegister() { + oSFRRegisters.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + addComponents(); + buildGUIRegister(); + setWidth(); + setTheme(0); + } + + private void addComponents() { + oLabels.add(oSFR); + oLabels.add(oW); + + oTables.add(oSFRRegisters); + oTables.add(oWRegister); + + oPanels.add(oPanelSFR); + oPanels.add(oPanelW); + oPanels.add(this); + } + + private void buildGUIRegister() { + GridBagConstraints oConstraints = new GridBagConstraints(); + oPanelSFR.setLayout(new GridBagLayout()); + oConstraints.gridx = 0; + oConstraints.gridy = 0; + oConstraints.anchor = GridBagConstraints.WEST; + oPanelSFR.add(oSFR, oConstraints); + oConstraints.gridy = 1; + oPanelSFR.add(oSFRRegisters, oConstraints); + + oPanelW.setLayout(new GridBagLayout()); + oConstraints.gridy = 0; + oPanelW.add(oW, oConstraints); + oConstraints.gridy = 1; + oPanelW.add(oWRegister, oConstraints); + + this.setLayout(new GridBagLayout()); + oConstraints.gridy = 0; + this.add(oPanelSFR, oConstraints); + oConstraints.gridy = 1; + this.add(oPanelW, oConstraints); + } + + private void setWidth() { + for (int i = 0; i < 4; i++) { + oSFRRegisters.getColumn(i + "").setPreferredWidth(100); + } + for (int i = 0; i < 4; i++) { + oWRegister.getColumn(i + "").setPreferredWidth(100); + } + } + + public void setTheme(int iThemeNr) { + switch (iThemeNr) { + case 0: { + for (JLabel oLabel : oLabels) { + oLabel.setForeground(aoLightTheme[0]); + oLabel.setBackground(aoLightTheme[1]); + } + for (JTable oTable : oTables) { + oTable.setForeground(aoLightTheme[0]); + oTable.setBackground(aoLightTheme[1]); + oTable.setBorder(BorderFactory.createLineBorder(aoLightTheme[2])); + oTable.setGridColor(aoLightTheme[2]); + } + for (JPanel oPanel : oPanels) { + oPanel.setForeground(aoLightTheme[0]); + oPanel.setBackground(aoLightTheme[1]); + oPanel.setBorder(BorderFactory.createLineBorder(aoLightTheme[2])); + } + this.setBorder(BorderFactory.createLineBorder(aoLightTheme[2])); + }break; + case 1: { + for (JLabel oLabel : oLabels) { + oLabel.setForeground(aoDarkTheme[0]); + oLabel.setBackground(aoDarkTheme[1]); + } + for (JTable oTable : oTables) { + oTable.setForeground(aoDarkTheme[0]); + oTable.setBackground(aoDarkTheme[1]); + oTable.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2])); + oTable.setGridColor(aoDarkTheme[2]); + } + for (JPanel oPanel : oPanels) { + oPanel.setForeground(aoDarkTheme[0]); + oPanel.setBackground(aoDarkTheme[1]); + oPanel.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2])); + } + this.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2])); + }break; + } + } +} \ No newline at end of file diff --git a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.java b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.java deleted file mode 100644 index e353f47..0000000 --- a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegisters.java +++ /dev/null @@ -1,288 +0,0 @@ -package View.PIC_SIMULATOR_GUI_JAVA; - -import java.awt.GridBagLayout; -import java.util.ArrayList; -import java.awt.Color; -import java.awt.GridBagConstraints; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public class GUIRegisters 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)}; - - ArrayList oTextfields = new ArrayList(); - ArrayList oPanels = new ArrayList(); - - JPanel oLeftComponentPanel = new JPanel(); - JPanel oRightComponentPanel = new JPanel(); - - int iTextFieldSize = 15; - - JTextField oTextSFR = new JTextField("SFR", iTextFieldSize); - - JTextField oTextPCL = new JTextField("PCL", iTextFieldSize); - JTextField oTextPCLATH = new JTextField("PCLATH", iTextFieldSize); - JTextField oTextPCIntern = new JTextField("PC intern", iTextFieldSize); - JTextField oTextStatus = new JTextField("STATUS", iTextFieldSize); - JTextField oTextFileSelectionRegister = new JTextField("FileSelectionRegister", iTextFieldSize); - JTextField oTextOption = new JTextField("OPTION", iTextFieldSize); - JTextField oTextPrescaler = new JTextField("Prescaler", iTextFieldSize); - JTextField oTextTMR0 = new JTextField("TMR0", iTextFieldSize); - - JTextField oValuePCL = new JTextField("00", 2); - JTextField oValuePCLATH = new JTextField("00", 2); - JTextField oValuePCIntern = new JTextField("00", 2); - JTextField oValueStatus = new JTextField("00", 2); - JTextField oValueFileSelectionRegister = new JTextField("00", 2); - JTextField oValueOption = new JTextField("00", 2); - JTextField oValuePrescaler = new JTextField("00", 2); - JTextField oValueTMR0 = new JTextField("00", 2); - - JTextField oFillTextField1 = new JTextField("", iTextFieldSize); - JTextField oFillValueField1 = new JTextField("", 2); - JTextField oFillTextField2 = new JTextField("", iTextFieldSize); - JTextField oFillValueField2 = new JTextField("", 2); - JTextField oFillTextField3 = new JTextField("", iTextFieldSize); - JTextField oFillValueField3 = new JTextField("", 2); - JTextField oFillValueField4 = new JTextField("", 2); - JTextField oFillValueField5 = new JTextField("", 2); - - JTextField oTextW = new JTextField("W", iTextFieldSize); - JTextField oTextWRegister = new JTextField("W-Register", iTextFieldSize); - JTextField oValueWRegister = new JTextField("00", 2); - - /** - * Constructor of register-table-class, adds components to list, sets components uneditable, - * builds register-table and colors according to theme. - */ - public GUIRegisters() { - addComponentsToLists(); - setEditFalse(); - buildGUIRegisters(); - setTheme(0); - } - - /** - * Builds register-panel by actually setting the positions of the fields and adding them to the panels. - */ - private void buildGUIRegisters() { - GridBagConstraints oConstraints = new GridBagConstraints(); - - oLeftComponentPanel.setLayout(new GridBagLayout()); - oRightComponentPanel.setLayout(new GridBagLayout()); - - this.setLayout(new GridBagLayout()); - - //Fill left component panel "header" - oConstraints.gridx = 0; - oConstraints.gridy = 0; - oConstraints.anchor = GridBagConstraints.WEST; - oLeftComponentPanel.add(oTextSFR, oConstraints); - oConstraints.gridx = 1; - oLeftComponentPanel.add(oFillValueField1, oConstraints); - - //Fill left side of left component panel - oConstraints.gridx = 0; - oConstraints.gridy = 1; - oLeftComponentPanel.add(oTextPCL, oConstraints); - oConstraints.gridy = 2; - oLeftComponentPanel.add(oTextPCLATH, oConstraints); - oConstraints.gridy = 3; - oLeftComponentPanel.add(oTextPCIntern, oConstraints); - oConstraints.gridy = 4; - oLeftComponentPanel.add(oTextStatus, oConstraints); - - //Fill right side of left component panel - oConstraints.gridx = 1; - oConstraints.gridy = 1; - oConstraints.anchor = GridBagConstraints.EAST; - oLeftComponentPanel.add(oValuePCL, oConstraints); - oConstraints.gridy = 2; - oLeftComponentPanel.add(oValuePCLATH, oConstraints); - oConstraints.gridy = 3; - oLeftComponentPanel.add(oValuePCIntern, oConstraints); - oConstraints.gridy = 4; - oLeftComponentPanel.add(oValueStatus, oConstraints); - - //Fill left side of right component panel - oConstraints.gridx = 0; - oConstraints.gridy = 0; - oConstraints.anchor = GridBagConstraints.WEST; - oRightComponentPanel.add(oFillTextField1, oConstraints); - oConstraints.gridy = 1; - oRightComponentPanel.add(oTextFileSelectionRegister, oConstraints); - oConstraints.gridy = 2; - oRightComponentPanel.add(oTextOption, oConstraints); - oConstraints.gridy = 3; - oRightComponentPanel.add(oTextPrescaler, oConstraints); - oConstraints.gridy = 4; - oRightComponentPanel.add(oTextTMR0, oConstraints); - oConstraints.gridy = 5; - oRightComponentPanel.add(oFillTextField2, oConstraints); - oConstraints.gridy = 6; - oRightComponentPanel.add(oFillTextField3, oConstraints); - - //Fill right side of right component panel - oConstraints.gridx = 1; - oConstraints.gridy = 0; - oConstraints.anchor = GridBagConstraints.EAST; - oRightComponentPanel.add(oFillValueField2, oConstraints); - oConstraints.gridy = 1; - oRightComponentPanel.add(oValueFileSelectionRegister, oConstraints); - oConstraints.gridy = 2; - oRightComponentPanel.add(oValueOption, oConstraints); - oConstraints.gridy = 3; - oRightComponentPanel.add(oValuePrescaler, oConstraints); - oConstraints.gridy = 4; - oRightComponentPanel.add(oValueTMR0, oConstraints); - oConstraints.gridy = 5; - oRightComponentPanel.add(oFillValueField3, oConstraints); - oConstraints.gridy = 6; - oRightComponentPanel.add(oFillValueField4, oConstraints); - - //Fill footer of left component panel - oConstraints.anchor = GridBagConstraints.WEST; - oConstraints.gridx = 0; - oConstraints.gridy = 5; - oLeftComponentPanel.add(oTextW, oConstraints); - oConstraints.anchor = GridBagConstraints.EAST; - oConstraints.gridx = 1; - oLeftComponentPanel.add(oFillValueField5, oConstraints); - oConstraints.gridx = 0; - oConstraints.gridy = 6; - oLeftComponentPanel.add(oTextWRegister, oConstraints); - oConstraints.anchor = GridBagConstraints.EAST; - oConstraints.gridx = 1; - oLeftComponentPanel.add(oValueWRegister, oConstraints); - - //Fill this panel - oConstraints.anchor = GridBagConstraints.WEST; - oConstraints.gridx = 0; - oConstraints.gridy = 0; - this.add(oLeftComponentPanel, oConstraints); - oConstraints.gridx = 1; - this.add(oRightComponentPanel, oConstraints); - } - - private void changeWidth() { - - } - - /** - * Adds panels to panel list and textfields to textfield list - */ - private void addComponentsToLists() { - oTextfields.add(oTextSFR); - oTextfields.add(oTextPCL); - oTextfields.add(oTextPCLATH); - oTextfields.add(oTextPCIntern); - oTextfields.add(oTextStatus); - oTextfields.add(oTextFileSelectionRegister); - oTextfields.add(oTextOption); - oTextfields.add(oTextPrescaler); - oTextfields.add(oTextTMR0); - oTextfields.add(oTextW); - oTextfields.add(oTextWRegister); - oTextfields.add(oFillTextField1); - oTextfields.add(oFillTextField2); - oTextfields.add(oFillTextField3); - - oTextfields.add(oValuePCL); - oTextfields.add(oValuePCLATH); - oTextfields.add(oValuePCIntern); - oTextfields.add(oValueStatus); - oTextfields.add(oValueFileSelectionRegister); - oTextfields.add(oValueOption); - oTextfields.add(oValuePrescaler); - oTextfields.add(oValueTMR0); - oTextfields.add(oValueWRegister); - oTextfields.add(oFillValueField1); - oTextfields.add(oFillValueField2); - oTextfields.add(oFillValueField3); - oTextfields.add(oFillValueField4); - oTextfields.add(oFillValueField5); - - oPanels.add(oLeftComponentPanel); - oPanels.add(oRightComponentPanel); - } - - /** - * Set edit all textfields to false. - */ - private void setEditFalse() { - for (JTextField oTextfield : oTextfields) { - oTextfield.setEditable(false); - } - } - - /** - * Sets textfields of registervalues. - * @param aiRegisters - */ - public void setRegisters(int[] aiRegisters) { - oValuePCL.setText(aiRegisters[0] + ""); - oValuePCLATH.setText(aiRegisters[1] + ""); - oValuePCIntern.setText(aiRegisters[2] + ""); - oValueStatus.setText(aiRegisters[3] + ""); - oValueFileSelectionRegister.setText(aiRegisters[4] + ""); - oValueOption.setText(aiRegisters[5] + ""); - oValuePrescaler.setText(aiRegisters[6] + ""); - oValueTMR0.setText(aiRegisters[7] + ""); - oValueWRegister.setText(aiRegisters[8] + ""); - } - - /** - * Set theme of RegisterTable - * @param iThemeNr 0 == light theme, 1 == dark theme - */ - public void setTheme(int iThemeNr) { - switch (iThemeNr) { - case 0: { //light theme - for (JPanel oPanel : oPanels) { - oPanel.setForeground(aoLightTheme[0]); - oPanel.setBackground(aoLightTheme[1]); - oPanel.setBorder(BorderFactory.createLineBorder(aoLightTheme[1])); - } - for (JTextField oTextfield : oTextfields) { - oTextfield.setForeground(aoLightTheme[0]); - oTextfield.setBackground(aoLightTheme[1]); - oTextfield.setBorder(BorderFactory.createLineBorder(aoLightTheme[2])); - } - this.setBorder(BorderFactory.createLineBorder(aoLightTheme[2], 3)); - }break; - - case 1: { //dark theme - for (JPanel oPanel : oPanels) { - oPanel.setForeground(aoDarkTheme[0]); - oPanel.setBackground(aoDarkTheme[1]); - oPanel.setBorder(BorderFactory.createLineBorder(aoDarkTheme[1])); - } - for (JTextField oTextfield : oTextfields) { - oTextfield.setForeground(aoDarkTheme[0]); - oTextfield.setBackground(aoDarkTheme[1]); - oTextfield.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2])); - } - this.setBorder(BorderFactory.createLineBorder(aoDarkTheme[2], 3)); - }break; - } - } -} \ No newline at end of file diff --git a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.java b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.java index 04a1d67..ee2986a 100644 --- a/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.java +++ b/src/View/PIC_SIMULATOR_GUI_JAVA/GUIRegistersDetailed.java @@ -32,8 +32,8 @@ public class GUIRegistersDetailed extends JPanel { 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)}; JTable oStatusTable; - JTable oOptionTable = new JTable(); - JTable oIntconTable = new JTable(); + JTable oOptionTable; + JTable oIntconTable; JPanel oStatusPanel = new JPanel(); JPanel oOptionPanel = new JPanel(); @@ -74,7 +74,7 @@ public class GUIRegistersDetailed extends JPanel { oStatusPanel.add(oStatusTable, oConstraintsStatus); for (int i = 0; i < 8; i++) { - oStatusTable.getColumn(i + "").setMaxWidth(50); + oStatusTable.getColumn(i + "").setPreferredWidth(50); } oStatusTable.setEnabled(false); @@ -92,7 +92,7 @@ public class GUIRegistersDetailed extends JPanel { oOptionPanel.add(oOptionTable, oConstraintsOption); for (int i = 0; i < 8; i++) { - oOptionTable.getColumn(i + "").setMaxWidth(50); + oOptionTable.getColumn(i + "").setPreferredWidth(50); } oOptionTable.setEnabled(false);