use of org.javatari.atari.network.RemoteReceiver in project javatari by ppeccin.
the class JComboBoxNim method clientConnectAction.
private void clientConnectAction() {
if (!room.isClientMode()) {
// Will try to CONNECT
gray(true);
room.morphToClientMode();
SwingHelper.edtInvokeLater(new Runnable() {
@Override
public void run() {
setupConnectionStatusListeners();
String serverAddress = "";
try {
RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
serverAddress = clientServerAddressTf.getText().trim();
receiver.connect(serverAddress);
closeAction();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Connection failed: " + serverAddress + "\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
room.morphToStandaloneMode();
}
refreshMultiplayer();
gray(false);
}
});
} else {
// Will try to DISCONNECT
try {
RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
receiver.disconnect();
room.morphToStandaloneMode();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error disconnecting from Server:\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
}
refreshMultiplayer();
}
}
use of org.javatari.atari.network.RemoteReceiver in project javatari by ppeccin.
the class Room method buildAndPlugClientConsole.
protected ClientConsole buildAndPlugClientConsole() {
RemoteReceiver remoteReceiver = new RemoteReceiver();
clientConsole = new ClientConsole(remoteReceiver);
plugConsole(clientConsole);
return clientConsole;
}
Aggregations