Beispiel #1
2
  public static void message(String msg, StackPane pane) {

    Label warningL = new Label(msg);
    Labels.setLabelStyle(warningL, Custom.TEXT_SIZE_LARGER, true);
    warningL.setTextAlignment(TextAlignment.CENTER);

    StackPane warningPane = new StackPane();
    warningPane.getChildren().add(warningL);
    warningPane.setStyle(Custom.WINDOW_STYLING);
    warningPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setBorder(
        new Border(
            new BorderStroke(
                Paint.valueOf("#000000"),
                BorderStrokeStyle.SOLID,
                new CornerRadii(30),
                new BorderWidths(5))));

    pane.getChildren().add(warningPane);

    PauseTransition pause = new PauseTransition(Duration.millis(1500));
    pause.setOnFinished(
        (f) -> {
          pane.getChildren().remove(warningPane);
          goBack();
        });
    pause.play();
  }
  @FXML
  void searchTktButton(ActionEvent event) {
    // send a request to server for searching a ticket from database

    c.setDate(datePick.getValue());
    c.setAC(ACradioButton.isSelected());
    c.setNonAC(nonACradioButton.isSelected());
    if (allOptionsFilledUp()) {
      try {
        main.availableBusView();
      } catch (Exception e) {
        e.printStackTrace();
      }

      /*
      try {
          //String serverAddress="127.0.0.1";
          //int serverPort=55555;
          //NetworkUtil nc = new NetworkUtil(serverAddress,serverPort);

          //nc.write(c);

      } catch(Exception e) {
          System.out.println (e);
      }
      */

    } else {
      alert.setVisible(true);
      PauseTransition visiblePause =
          new PauseTransition(
              Duration.seconds(2)); // making the "alert" label visible for 2 seconds
      visiblePause.setOnFinished(Event -> alert.setVisible(false));
      visiblePause.play();
    }
  }
 public void applyTo(javafx.animation.PauseTransition x) {
   super.applyTo(x);
   if (__set) x.setDuration(this.duration);
 }