diff --git a/src/tec/letsgoing/ardublock/simulator/view/GUI.java b/src/tec/letsgoing/ardublock/simulator/view/GUI.java index cb2516d70fed884ed939ee66dd612d35c8d53cde..6bfcc4331be76e8458fa76f21818ba2dd80120af 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/GUI.java +++ b/src/tec/letsgoing/ardublock/simulator/view/GUI.java @@ -169,10 +169,7 @@ public class GUI extends JFrame implements Runnable, ActionListener { modules[2].updateGUI(xscale, yscale); modules[3].updateGUI(xscale, yscale); - - - - + } diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java index ab6352dcf2444f19ea650635b4ec234c10bf5e54..84618c466aec133161154b553673ddd242a0eb12 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java @@ -55,8 +55,11 @@ public class ArduinoUno extends Modul { } @Override - public void updateGUI(int xscale, int yscale) { + public void updateGUI(int _xscale, int _yscale) { + + this.xscale = _xscale; + this.yscale = _yscale; // Offset für den Arduino um diesen mehr mittig zu platzieren. int locx = ((int)(0.0516*xscale)); int locy = ((int)(0.0517*yscale)); diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java index 05f4c5d8c9a1e3fd8cf4d1b7984211b37ec08276..fe09ebb424d3a94d0f2ac21c090cc9bc476ff9dc 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java @@ -44,7 +44,7 @@ public class Button extends Modul implements ActionListener { label2 = new JLabel(); label3 = new JLabel(); updateGUI(xscale, yscale); - calculatePinPos(); + } public void updateGUI(int _xscale, int _yscale){ @@ -91,6 +91,8 @@ public class Button extends Modul implements ActionListener { layerpane.add(label1, 0); layerpane.add(label2, 0); layerpane.add(label3, 0); + + calculatePinPos(); } public void updateModul(Pin pin) { diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java b/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java index 6e829fcf4fd4e70f6519b085c407c1e067166993..1eeea9a631115b8ef14a37d955a640ccdb7465eb 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/Poti.java @@ -64,12 +64,16 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener { updateGUI(xscale, yscale); - calculatePinPos(); + } @Override - public void updateGUI(int xscale, int yscale) { + public void updateGUI(int _xscale, int _yscale) { + + + this.xscale = _xscale; + this.yscale = _yscale; layerpane.setPreferredSize(new Dimension(((int)(0.3037*xscale)), ((int)(0.304*yscale)))); @@ -81,7 +85,7 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener { sliderPanel.setSize(((int)(0.2066*xscale)), ((int)(0.0517*yscale))); sliderPanel.setLocation(((int)(0.04855*xscale)), ((int)(0.175*yscale))); - + calculatePinPos(); } public void updateModul(Pin arg0) { diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java index 3f3d6467ab9d63cae22b2630788f531a9e0b3507..ce82e74d70c62067ab66074a5178b6ceebde53f0 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java @@ -28,6 +28,7 @@ public class RGB extends Modul { private int redValue = 0; private int greenValue = 0; private int blueValue = 0; + private int transparancy, tredValue, tgreenValue, tblueValue; private JLabel chiplabel, ledlabel; private ImageIcon chipIcon, chipIcon_temp; private int xscale = GUI.getxscale(); @@ -40,12 +41,15 @@ public class RGB extends Modul { chipIcon = _icon; updateGUI(xscale, yscale); - calculatePinPos(); + } @Override - public void updateGUI(int xscale, int yscale) { + public void updateGUI(int _xscale, int _yscale) { + + this.xscale = _xscale; + this.yscale = _yscale; // Erstellen der JLayerPane für das Modul layerpane.setPreferredSize(new Dimension(((int)(0.3037*xscale)), ((int)(0.304*yscale)))); @@ -62,8 +66,10 @@ public class RGB extends Modul { @Override public void paintComponent(Graphics g) { Graphics2D ga = (Graphics2D) g; - int transparancy = (int) (Math.max(redValue, Math.max(greenValue, blueValue)) * 0.9); - int tredValue = 0, tgreenValue = 0, tblueValue = 0; + transparancy = (int) (Math.max(redValue, Math.max(greenValue, blueValue)) * 0.9); + tredValue = 0; + tgreenValue = 0; + tblueValue = 0; if (transparancy != 0) { if (redValue > 0) tredValue = map(redValue); @@ -72,10 +78,12 @@ public class RGB extends Modul { if (blueValue > 0) tblueValue = map(blueValue); } - // System.out.println(tredValue+" "+ tgreenValue+" "+ tblueValue+" "+ - // transparancy); + //System.out.println(tredValue+" "+ tgreenValue+" "+ tblueValue+" "+ + //transparancy); + ga.setPaint(new Color(tredValue, tgreenValue, tblueValue, transparancy)); ga.fillOval(0, 0, ((int)(0.07541*xscale)), ((int)(0.07549*yscale))); + //System.out.println("blink"); } }; @@ -85,7 +93,7 @@ public class RGB extends Modul { ledlabel.setSize(((int)(0.2066*xscale)), ((int)(0.2068*yscale))); layerpane.add(ledlabel, 0); - + calculatePinPos(); } /**