Browse Source

Added the ability to gracefully close the window

cam
Cameron Weinfurt 2 years ago
parent
commit
1f5c25be38
  1. 16
      window/ChatWindow.java

16
window/ChatWindow.java

@ -113,6 +113,15 @@ public class ChatWindow extends Application {
@Override
public void start(Stage primaryStage) {
stage = primaryStage;
stage.setOnCloseRequest(windowEvent -> {
try {
protoOut.sendPart(username);
socket.close();
loginWindow.show();
} catch (IOException e) {
e.printStackTrace();
}
});
AnchorPane root = new AnchorPane();
primaryStage.setMaximized(true);
@ -216,13 +225,6 @@ public class ChatWindow extends Application {
}
}
@Override
public void stop() throws IOException {
protoOut.sendPart(username);
socket.close();
loginWindow.show();
}
public ArrayList<String> userList;
private String servername;

Loading…
Cancel
Save