diff --git a/src/tec/letsgoing/ardublock/simulator/view/GUI.java b/src/tec/letsgoing/ardublock/simulator/view/GUI.java index 30a83ad0fc82c6959dbce82a6bb788e8acf06965..49eb53f35a635184c6a14359ac6095ce120ba37a 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/GUI.java +++ b/src/tec/letsgoing/ardublock/simulator/view/GUI.java @@ -63,11 +63,11 @@ public class GUI extends JFrame implements Runnable, ActionListener { private JButton clearButton; private JCheckBox checkBox; private JScrollPane scrollPane; - private static int xscale= 968; - private static int yscale= 968; + private int xscale = 968; + private int yscale = 968; private JPanel modulPanel; private Container mainPane; - private int WindowHeight = 968, WindowWidth = 968, topPanelHeight, topPanelWidth, counter = 1; + private int WindowHeight = 968, WindowWidth = 968, topPanelHeight, topPanelWidth; /** * Konstruktor der Klasse GUI @@ -78,20 +78,20 @@ public class GUI extends JFrame implements Runnable, ActionListener { super("ArduBlock Simulator"); // Konstruktor der Module modules[0] = new RGB(new ImageIcon(getToolkit() - .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/PM31_RGB_LED.png")))); + .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/PM31_RGB_LED.png"))), xscale, yscale); modules[1] = new Button( new ImageIcon(getToolkit() .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/PM26_Taster.png"))), new ImageIcon(getToolkit() .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/Taster_Off.png"))), new ImageIcon(getToolkit() - .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/Taster_On.png")))); + .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/Taster_On.png"))), xscale, yscale); modules[2] = new Poti(new ImageIcon(getToolkit() - .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/PM24_Potentiometer.png")))); + .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/PM24_Potentiometer.png"))), xscale, yscale); modules[3] = new ArduinoUno( new ImageIcon(getToolkit() .getImage(GUI.class.getResource("/tec/letsgoing/ardublock/simulator/img/ArduinoUno.png"))), - simu); + simu, xscale, yscale); //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Vermutlich nicht // gew�nscht. @@ -146,13 +146,13 @@ public class GUI extends JFrame implements Runnable, ActionListener { - if(topPanelWidth <= ((topPanelHeight + WindowHeight) / 2)) { + if(topPanelWidth <= topPanelHeight) { xscale = topPanelWidth; yscale = topPanelWidth; } else { - xscale = (topPanelHeight + WindowHeight) / 2; - yscale = (topPanelHeight + WindowHeight) / 2; + xscale = topPanelHeight; + yscale = topPanelHeight; } //if(WindowWidth % 3 == 0 || WindowHeight % 3 == 0) { updateGUI(xscale, yscale); @@ -188,8 +188,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { public void updateGUI(int xscale, int yscale) { - counter = 0; - + modules[0].updateGUI(xscale, yscale); modules[1].updateGUI(xscale, yscale); modules[2].updateGUI(xscale, yscale); @@ -295,18 +294,21 @@ public class GUI extends JFrame implements Runnable, ActionListener { public void updateSerialLog(int size) { - + System.out.println(size); if(size >= 1000) { serialLog.setRows(4); // Anzahl der Angezeigten Reihen } - else if(size < 1000 && xscale >= 800) { + else if(size < 1000 && size >= 800) { serialLog.setRows(6); // Anzahl der Angezeigten Reihen } - else if(size < 800) { + else if(size < 800 && size >= 600) { serialLog.setRows(8); // Anzahl der Angezeigten Reihen } + else if(size < 600) { + serialLog.setRows(10); // Anzahl der Angezeigten Reihen + } } @@ -447,19 +449,5 @@ public class GUI extends JFrame implements Runnable, ActionListener { } - public static int getxscale() { - - return xscale; - } - - public static int getyscale() { - - return yscale; - } - - - - - } diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java index dd6f7b7b264c802dcab4914a3cfaae0456a63e2f..8d3a1b670d29ea4b98ec455e3d801273c50e2a88 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java @@ -33,10 +33,12 @@ public class ArduinoUno extends Modul { private JLabel labelPower, chiplabel, label13, labelButton; private ImageIcon chipIcon, chipIcon_temp; private JButton button; - private int xscale = GUI.getxscale(); - private int yscale = GUI.getyscale(); + private int xscale; + private int yscale; - public ArduinoUno(ImageIcon _icon, Simulator simu) { + public ArduinoUno(ImageIcon _icon, Simulator simu, int _xscale, int _yscale) { + this.xscale = _xscale; + this.yscale = _yscale; chiplabel = new JLabel(); chipIcon = _icon; button = new JButton(); diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java index bfd6ea43b329dcec6c3572819608ef5b514b2b23..45bd755d2dd49005e8a449285b61ba3dbbf6d388 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java @@ -29,10 +29,12 @@ public class Button extends Modul implements ActionListener { private ImageIcon iconOff, iconOn, chipIcon, chipIcon_temp, iconOff_temp, iconOn_temp; private JToggleButton but1, but2, but3; private JLabel chiplabel, label1, label2, label3; - private int xscale = GUI.getxscale(); - private int yscale = GUI.getyscale(); + private int xscale; + private int yscale; - public Button(ImageIcon _icon, ImageIcon _icon1, ImageIcon _icon2) { + public Button(ImageIcon _icon, ImageIcon _icon1, ImageIcon _icon2, int _xscale, int _yscale) { + this.xscale = _xscale; + this.yscale = _yscale; chipIcon = _icon; iconOff = _icon1; iconOn = _icon2; diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java b/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java index 80b2809cbcaa62da3a4541dea5f993446491a70a..168b8aa6eae70866e4cf0bfb4a40294b606dcf4c 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java @@ -36,10 +36,12 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener { private ImageIcon chipIcon, chipIcon_temp; private JPanel sliderPanel; private Hashtable<Integer, JLabel> labelTable; - private int xscale = GUI.getxscale(); - private int yscale = GUI.getyscale(); + private int xscale; + private int yscale; - public Poti(ImageIcon _icon) { + public Poti(ImageIcon _icon, int _xscale, int _yscale) { + this.xscale = _xscale; + this.yscale = _yscale; chipIcon = _icon; chiplabel = new JLabel(); labelTable = new Hashtable<Integer, JLabel>(); diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java index 32950144395f1c06ba17ac6a6b960706e1988815..fbce08a03d3aa15e998aeccf263ab9781d1c3ad7 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java @@ -31,11 +31,12 @@ public class RGB extends Modul { private int transparancy, tredValue, tgreenValue, tblueValue; private JLabel chiplabel, ledlabel; private ImageIcon chipIcon, chipIcon_temp; - private int xscale = GUI.getxscale(); - private int yscale = GUI.getyscale(); + private int xscale; + private int yscale; - public RGB(ImageIcon _icon) { - + public RGB(ImageIcon _icon, int _xscale, int _yscale) { + this.xscale = _xscale; + this.yscale = _yscale; chiplabel = new JLabel(); chipIcon = _icon;