-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
39 lines (37 loc) · 897 Bytes
/
Main.java
File metadata and controls
39 lines (37 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Main implements ActionListener
{
private static ThreadClient myThread;
private static boolean init_client;
public static void main(String []args)
{
Window root = new Window();
init_client = true;
root.btn_server_start.addActionListener(new Main());
root.btn_server_stop.addActionListener(new Main());
myThread = new ThreadClient(root);
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("start"))
{
if(init_client)
{
System.out.println("Iniciando el Cliente");
myThread.start();
init_client = false;
}
else
{
System.out.println("Enviando nuevos valores");
myThread.dataFlag = 1;
}
}
else if(e.getActionCommand().equals("stop"))
{
System.out.println("Finalizando el Cliente");
myThread.terminate();
}
}
}