Example #1
0
  @Override
  public void start(Stage primaryStage) throws Exception {

    Scene scene = new Scene(this.root);

    primaryStage.setResizable(false);
    primaryStage.setOnCloseRequest(
        e -> {
          String empty[] = null;
          this.chatConsoleReader.proccessCommand("exit", empty);
          Platform.exit();
          System.exit(0);
        });
    primaryStage.setTitle(
        "Chat: "
            + ChatConsoleReader.getInstance().getController().getChatroom()
            + "@"
            + ChatConsoleReader.getInstance().getController().getIP());
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Example #2
0
  public ChatWindow() {

    Logger.getRootLogger().addAppender(new GUIAppender(this));

    FXMLLoader loader =
        new FXMLLoader(getClass().getClassLoader().getResource("gui/chatwindow.fxml"));
    loader.setController(this);

    this.chatConsoleReader = ChatConsoleReader.getInstance();

    try {
      this.root = (GridPane) loader.load();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }