diff --git a/src/tec/letsgoing/ardublock/simulator/Simulator.java b/src/tec/letsgoing/ardublock/simulator/Simulator.java index a34761bf6c0d2d1b9b6fc0d638a3ca248970860e..ec6370a617ea92c20e6528d41086cf434b3effab 100644 --- a/src/tec/letsgoing/ardublock/simulator/Simulator.java +++ b/src/tec/letsgoing/ardublock/simulator/Simulator.java @@ -135,6 +135,7 @@ public class Simulator implements Runnable, ActionListener{ arduino.getPin(20).setValue(1023); // Power ON LED arduino.setStop(false); arduino.getFunction("main").run(arduino, null); + } /** diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java index 84618c466aec133161154b553673ddd242a0eb12..dd6f7b7b264c802dcab4914a3cfaae0456a63e2f 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/ArduinoUno.java @@ -57,6 +57,14 @@ public class ArduinoUno extends Modul { @Override public void updateGUI(int _xscale, int _yscale) { + //Alte label werden entfernt, wenn vorhanden. Da sonst die alten Label bestehen bleiben würden + if(labelPower != null) { + layerpane.remove(labelPower); + } + + if(label13 != null) { + layerpane.remove(label13); + } this.xscale = _xscale; this.yscale = _yscale; @@ -72,12 +80,13 @@ public class ArduinoUno extends Modul { chiplabel.setLocation(locx, locy); layerpane.add(chiplabel, 0); - // Label für die PowerLED + // Label für die PowerLED labelPower = new JLabel() { private static final long serialVersionUID = 1L; @Override public void paintComponent(Graphics g) { + Graphics2D ga = (Graphics2D) g; int transparancy = 0; if (ledOn) @@ -87,7 +96,7 @@ public class ArduinoUno extends Modul { } }; - + labelPower.setLocation(((int)(0.5207*xscale))+locx, ((int)(0.13*yscale))+locy); labelPower.setSize(((int)(0.02066*xscale)), ((int)(0.01034*yscale))); layerpane.add(labelPower, 0); @@ -129,7 +138,7 @@ public class ArduinoUno extends Modul { if (pin == pins.get(1)) { led13 = pin.getValue(); } - + } public boolean connect(Arduino _arduino) { diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java index fe09ebb424d3a94d0f2ac21c090cc9bc476ff9dc..958dbea74bad967678e7d060e6973f5af9e3532f 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/Button.java @@ -140,8 +140,7 @@ public class Button extends Modul implements ActionListener { lastState[pin] = value; pins.get(pin).setValue(value); - - System.out.println("called"); + } diff --git a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java index ce82e74d70c62067ab66074a5178b6ceebde53f0..32950144395f1c06ba17ac6a6b960706e1988815 100644 --- a/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java +++ b/src/tec/letsgoing/ardublock/simulator/view/modules/RGB.java @@ -48,6 +48,11 @@ public class RGB extends Modul { public void updateGUI(int _xscale, int _yscale) { + //Alte label werden entfernt, wenn vorhanden. Da sonst die alten Label bestehen bleiben würden + if(ledlabel != null) { + layerpane.remove(ledlabel); + } + this.xscale = _xscale; this.yscale = _yscale; @@ -57,7 +62,7 @@ public class RGB extends Modul { chipIcon_temp = new ImageIcon(chipIcon.getImage().getScaledInstance(((int)(0.3037*xscale)), ((int)(0.304*yscale)), Image.SCALE_SMOOTH)); chiplabel.setIcon(chipIcon_temp); chiplabel.setSize(((int)(0.3037*xscale)), ((int)(0.304*yscale))); - layerpane.add(chiplabel, 1); + layerpane.add(chiplabel, 0); // Erzeuge ein JLabel welches das Leuchten der LED darstellt. ledlabel = new JLabel() {