@Test
 public void test7() throws Throwable {
   final CountDownLatch l = new CountDownLatch(1);
   Platform.runLater(
       () -> {
         final Stage t = new Stage();
         final Scene s = new Scene(new Group());
         t.setScene(s);
         t.show();
         final Stage p = new Stage();
         p.show();
         Platform.runLater(
             () -> {
               try {
                 p.setScene(s);
                 p.hide();
                 t.hide();
               } finally {
                 l.countDown();
               }
             });
       });
   l.await();
   if (exception != null) {
     throw exception;
   }
 }
예제 #2
0
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
예제 #3
0
파일: Main.java 프로젝트: Vinusla/ContaCRF
  private void showSplash(
      final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
    progressText.textProperty().bind(task.messageProperty());
    loadProgress.progressProperty().bind(task.progressProperty());
    task.stateProperty()
        .addListener(
            (observableValue, oldState, newState) -> {
              if (newState == Worker.State.SUCCEEDED) {
                loadProgress.progressProperty().unbind();
                loadProgress.setProgress(1);
                initStage.toFront();
                FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
                fadeSplash.setFromValue(1.0);
                fadeSplash.setToValue(0.0);
                fadeSplash.setOnFinished(actionEvent -> initStage.hide());
                fadeSplash.play();

                initCompletionHandler.complete();
              } // todo add code to gracefully handle other task states.
            });

    Scene splashScene = new Scene(splashLayout);
    initStage.initStyle(StageStyle.UNDECORATED);
    final Rectangle2D bounds = Screen.getPrimary().getBounds();
    initStage.setScene(splashScene);
    initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
    initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
    initStage.show();
  }
예제 #4
0
  /**
   * The stop method is the opposite of the start method. It provides an opportunity to close down
   * the program, including GUI components. If the start method has never been called, the stop
   * method may or may not be called.
   *
   * <p>Make the GUI invisible first. This prevents the user from taking any actions while the
   * program is ending.
   */
  @Override
  public void stop() {
    if (serverStage != null) {
      // Make the view invisible
      // Commented because of errors - serviceLocator.getLogger().info("Server-GUI wird beendet");
      // // HIIIER Kommt wohl kein check durch - ist es wirklich view den wir prüfen müssen??
      serverStage.hide();
    }
    if (serverStage != null) {
      Platform.exit(); // Ends all JavaFX activities
      System.exit(0); // Ends all Programm activities
    }

    serviceLocator.getLogger().info("nach dem if vom Server_Template stopp");
    serviceLocator
        .setChangeValueWindowIsActive(); // Changes the ServiceLocator Value for WindowIsActive to
    // false so that the thread ShowTimeInWindow() stops

    // More cleanup code as needed

    serviceLocator
        .getLogger()
        .info("Application terminated"); // Wieso wird diese Message jetzt mit "appStage.hide();"
    // nicht mehr angezeigt?
  }
예제 #5
0
파일: PainelFx.java 프로젝트: sonis/novosga
 public void hide() {
     // destruindo o layout anterior
     if (currentLayout != null) {
         currentLayout.destroy();
     }
     stage.hide();
 }
예제 #6
0
 @FXML
 private void handlebutton(ActionEvent event) throws IOException {
   System.out.println("hola");
   Parent paren = FXMLLoader.load(getClass().getResource("sample.fxml"));
   Scene scen = new Scene(paren);
   Stage stag = (Stage) ((Node) event.getSource()).getScene().getWindow();
   stag.hide();
   stag.setScene(scen);
   stag.show();
 }
  private void displayOnStage(Stage newStage, Stage oldStage) {
    oldStage.setScene(null);

    newStage.setScene(scene);
    newStage.show();

    setupStageLocation(newStage);

    newStage.toFront();
    oldStage.hide();
  }
예제 #8
0
  public void hide() {

    if (logger.isDebugEnabled()) {
      logger.debug("[SHOW]");
    }

    if (stage != null && stage.isShowing()) {
      if (logger.isDebugEnabled()) {
        logger.debug("[SHOW] stage is not null and is showing");
      }
      stage.hide();
    }
  }
 @Test
 public void test3() throws Throwable {
   final CountDownLatch l = new CountDownLatch(1);
   Platform.runLater(
       () -> {
         final Stage t = new Stage();
         t.show();
         Platform.runLater(
             () -> {
               try {
                 t.hide();
               } finally {
                 l.countDown();
               }
             });
       });
   l.await();
   if (exception != null) {
     throw exception;
   }
 }
예제 #10
0
  /** Constructor */
  public MyUpdater(Label stat, Stage st, VBox sl, ProgressBar bar) {
    status = stat;
    progressBar = bar;
    splashLayout = sl;
    splashStage = st;

    Yes = new Button("yes");
    Yes.setOnAction(event1 -> downloadupdate());
    Yes.setMaxWidth(Double.MAX_VALUE);
    No = new Button("No");
    No.setOnAction(
        event -> {
          splashStage.hide();
          isready.set(true);
        });
    No.setMaxWidth(Double.MAX_VALUE);

    updateLayout = new HBox(Yes, No);
    HBox.setHgrow(Yes, Priority.ALWAYS);
    HBox.setHgrow(No, Priority.ALWAYS);
  }
예제 #11
0
  private void setTrayIcon(Stage primaryStage)
      throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException,
          IllegalAccessException {

    if (!SystemTray.isSupported()) {
      return;
    }

    SystemTray sTray = SystemTray.getSystemTray();
    primaryStage.setOnCloseRequest(arg0 -> primaryStage.hide());
    JPopupMenu popup = buildSystemTrayJPopupMenu(primaryStage);
    URL url = System.class.getResource("/logo-invert_small.png");
    Image img = Toolkit.getDefaultToolkit().getImage(url);
    TrayIcon icon = new TrayIcon(img, "Qabel");

    icon.setImageAutoSize(true);
    trayIconListener(popup, icon);

    try {
      sTray.add(icon);
    } catch (AWTException e) {
      logger.error("failed to add tray icon: " + e.getMessage(), e);
    }
  }
예제 #12
0
 public FXDialog addCancel() {
   Button cancelBtn = new Button("Cancel");
   cancelBtn.setOnAction(event -> stage.hide());
   buttonArea.getChildren().add(cancelBtn);
   return this;
 }
예제 #13
0
 public void hide() {
   stage.hide();
 }
예제 #14
0
 /** hides the error message */
 public void hide() {
   stage.hide();
   MainStage.getInstance().show();
 }
예제 #15
0
 @After
 public void tearDown() {
   stage.hide();
 }
예제 #16
0
 public void actionClose(ActionEvent actionEvent) {
   Node source = (Node) actionEvent.getSource();
   Stage stage = (Stage) source.getScene().getWindow();
   stage.hide();
 }
예제 #17
0
 @Override
 public void hide() {
   stage.hide();
 }