Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.etrice.tutorials.simulators.trafficlight/src/org/eclipse/etrice/tutorials/simulators/trafficlight/ButtonActionListener.java')
-rw-r--r--examples/org.eclipse.etrice.tutorials.simulators.trafficlight/src/org/eclipse/etrice/tutorials/simulators/trafficlight/ButtonActionListener.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/org.eclipse.etrice.tutorials.simulators.trafficlight/src/org/eclipse/etrice/tutorials/simulators/trafficlight/ButtonActionListener.java b/examples/org.eclipse.etrice.tutorials.simulators.trafficlight/src/org/eclipse/etrice/tutorials/simulators/trafficlight/ButtonActionListener.java
new file mode 100644
index 000000000..a8e6a92ff
--- /dev/null
+++ b/examples/org.eclipse.etrice.tutorials.simulators.trafficlight/src/org/eclipse/etrice/tutorials/simulators/trafficlight/ButtonActionListener.java
@@ -0,0 +1,35 @@
+package org.eclipse.etrice.tutorials.simulators.trafficlight;
+
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.OutputStream;
+import java.io.IOException;
+
+public class ButtonActionListener
+implements ActionListener {
+
+ private OutputStream out;
+ private String cmd1 = "requestGreen";
+
+ public ButtonActionListener(OutputStream out){
+ this.out = out;
+ }
+
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ String s = arg0.getActionCommand();
+
+ if (s.equals("REQUEST")) {
+ System.out.println("Taste gedrückt");
+ try {
+ out.write(cmd1.getBytes());
+ out.flush();
+ }
+ catch (IOException e){
+ System.out.println(e.toString());
+ }
+ // out.write(cmd1.getBytes());
+ }
+ }
+}

Back to the top