More ui, going to redesign.
[FinalKeyGui.git] / src / fkgui / FireActionListener.java
1 package fkgui;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 import jssc.SerialPort;
7 import jssc.SerialPortException;
8
9 public class FireActionListener implements ActionListener {
10         public String name;
11         public String num;
12         public String action;
13         public SerialPort port;
14         public void actionPerformed(ActionEvent e) {
15                 System.out.println("Performing action " + action + " on account ("+num+") - "+name );
16                 if(!action.equals("%"))
17                 {
18                         System.out.println("Here");
19                         try
20                         {
21                                 port.writeBytes(action.getBytes());
22                         } catch( Exception ex )
23                         {
24                                 ex.printStackTrace();
25                         }
26                 }
27                 
28                 try {
29                         port.writeBytes(num.toLowerCase().getBytes());
30         
31                         try {
32                                 Thread.sleep(400);
33                         } catch (InterruptedException e1) {
34                                 // TODO Auto-generated catch block
35                                 e1.printStackTrace();
36                         }
37                         System.out.println( port.readString() );
38                         
39                 } catch (SerialPortException e1) {
40                         // TODO Auto-generated catch block
41                         e1.printStackTrace();
42                 }
43                 
44                 
45                 
46         }
47
48 }