Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Java_TP/src/fr/univ/lyon1/gui/ClientGUI.java
Florian Charlaix 57501b7b93 Merge branch 'flifloo'
# Conflicts:
#	.gitignore
#	pom.xml
#	src/fr/univ/lyon1/gui/ClientGUI.java
#	src/module-info.java
2022-01-07 10:31:56 +01:00

34 lines
875 B
Java

package fr.univ.lyon1.gui;
import fr.univ.lyon1.client.Client;
import fr.univ.lyon1.client.ClientReceive;
import fr.univ.lyon1.common.Message;
import fr.univ.lyon1.gui.handlers.MainHandler;
import fr.univ.lyon1.common.command.Command;
import java.io.IOException;
public class ClientGUI extends Client {
private final MainHandler gui;
public ClientGUI(MainHandler handler, String address, int port) throws Exception {
super(address, port, null, null);
this.gui = handler;
}
@Override
protected void commandMessage(Command cmd) {
gui.receiveMessage(cmd.getArgs().get(0).toString());
}
@Override
public void run() {
if (started)
return;
Thread clientReceiveThread = new Thread(new ClientReceive(this, super.socket));
clientReceiveThread.start();
started = true;
}
}