java类javafx.stage.Popup的实例源码

GameOver.java 文件源码 项目:xpanderfx 阅读 23 收藏 0 点赞 0 评论 0
/**
 * shows game-over pop-up.
 * @param controller 
 */
private void showGameOverPopup(MainFXMLDocumentController controller) {
    @SuppressWarnings("deprecation")
    BorderPane content =BorderPaneBuilder.create()
         .minWidth(230).minHeight(130)
         .bottom(getBottomBox(controller))
         .center(getCenterBox())
         .style(              "-fx-background-color:linear-gradient(darkslategrey, wheat, white);"
              + "-fx-background-radius:7;"
              + "-fx-border-radius:7")
         .build();
    pp = new Popup();
    pp.setAutoHide(true);
    pp.getContent().add(content);
    pp.show(controller.DOWN.getScene().getWindow());
}
ProjectItemPresenter.java 文件源码 项目:Incubator 阅读 23 收藏 0 点赞 0 评论 0
public void onMouseClickedShowItemMenuPopup(MouseEvent event) {
    LoggerFacade.INSTANCE.debug(this.getClass(), "On mouse clicked show ItemMenu popup"); // NOI18N

    if (!event.getButton().equals(MouseButton.SECONDARY)) {
        return;
    }

    final Popup popup = new Popup();
    popup.setAutoFix(true);
    popup.setAutoHide(true);
    popup.setHideOnEscape(true);

    final ItemMenuPopupView view = new ItemMenuPopupView();
    final ItemMenuPopupPresenter presenter = view.getRealPresenter();
    presenter.configure(popup, model);
    popup.getContent().add(view.getView());

    popup.show(parent, event.getScreenX(), event.getScreenY());
}
GargoyleNotification.java 文件源码 项目:Gargoyle 阅读 21 收藏 0 点赞 0 评论 0
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay) {
    KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

    KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);

    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(startDelay);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            hide(popup, p);
        }
    });

    return timeline;
}
BasicEntityEditor.java 文件源码 项目:myWMS 阅读 23 收藏 0 点赞 0 评论 0
protected PopupWindow createPopup() {
    ListView<BODTO<T>> listView = new ListView<>();
    listView.getStyleClass().addAll("combo-box-popup");
    listView.setItems(completionItems);
    listView.cellFactoryProperty().bind(control.cellFactoryProperty());
    listView.setOnKeyReleased(e -> { 
        if (e.getCode() == KeyCode.ENTER ) { select(listView); e.consume(); }
        if (e.getCode() == KeyCode.ESCAPE ) { hidePopup(); e.consume(); }
    });

    listView.setOnMouseClicked(e -> { if (e.getClickCount() == 1) select(listView); e.consume();});

    Popup popup = new Popup();
    control.showPopup.bind(popup.showingProperty());
    popup.getContent().add(listView);
    textInput.updateValue("");
    return popup;
}
Notifications.java 文件源码 项目:yfiton 阅读 23 收藏 0 点赞 0 评论 0
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay, Notifications notification) {
    KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

    KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);

    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(startDelay);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            hide(popup, p);
            notification.onHideAction.handle(e);
        }
    });

    return timeline;
}
MainPageController.java 文件源码 项目:grantmaster 阅读 21 收藏 0 点赞 0 评论 0
@FXML
private void handleContextHelpButtonAction(ActionEvent event) {
 final Popup popup = new Popup();

  Tab activeTab = TabSelectionChangeListener.getActiveTab();
  if (activeTab == null || activeTab.getUserData() == null) {
    return;
  }
  // The help text is currently stored in userData.
  // TODO(gaborfeher): Find a better place.
  String helpText = (String) activeTab.getUserData();
  Label popupLabel = new Label(helpText);
  popupLabel.setStyle("-fx-border-color: black;");
  popup.setAutoHide(true);
  popup.setAutoFix(true);
  // Calculate popup placement coordinates.
  Node eventSource = (Node) event.getSource();
  Bounds sourceNodeBounds = eventSource.localToScreen(eventSource.getBoundsInLocal());
  popup.setX(sourceNodeBounds.getMinX() - 5.0);
  popup.setY(sourceNodeBounds.getMaxY() + 5.0);
  popup.getContent().addAll(popupLabel);
  popup.show(stage);
}
ListViewHelperMainController.java 文件源码 项目:examples-javafx-repos1 阅读 18 收藏 0 点赞 0 评论 0
@FXML
public void showEmployeesHelper(ActionEvent evt) {

    Button btn = (Button)evt.getSource();

    Point2D point = btn.localToScreen(0.0d + btn.getWidth(), 0.0d - btn.getHeight());

    try {

        Popup employeesHelper = new ListViewHelperEmployeesPopup(tfEmployee, point);

        employeesHelper.show(btn.getScene().getWindow());

    } catch(Exception exc) {
        exc.printStackTrace();
        Alert alert = new Alert(AlertType.ERROR, "Error creating employees popup; exiting");
        alert.showAndWait();
        btn.getScene().getWindow().hide();  // close and implicit exit
    }
}
Notifications.java 文件源码 项目:yfiton 阅读 22 收藏 0 点赞 0 评论 0
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay, Notifications notification) {
    KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

    KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);

    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(startDelay);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            hide(popup, p);
            notification.onHideAction.handle(e);
        }
    });

    return timeline;
}
CardPlayedToken.java 文件源码 项目:metastone 阅读 21 收藏 0 点赞 0 评论 0
public CardPlayedToken(GameBoardView boardView, Card card) {
    Window parent = boardView.getScene().getWindow();
    this.cardToken = new CardTooltip();

    popup = new Popup();
    popup.getContent().setAll(cardToken);
    popup.setX(parent.getX() + 40);
    popup.show(parent);
    popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

    cardToken.setCard(card);

    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
    animation.setDelay(Duration.seconds(0.6f));
    animation.setOnFinished(this::onComplete);
    animation.setFromValue(1);
    animation.setToValue(0);
    animation.play();
}
CardRevealedToken.java 文件源码 项目:metastone 阅读 24 收藏 0 点赞 0 评论 0
public CardRevealedToken(GameBoardView boardView, Card card, double delay) {
    Window parent = boardView.getScene().getWindow();
    this.cardToken = new CardTooltip();

    popup = new Popup();
    popup.getContent().setAll(cardToken);
    popup.setX(parent.getX() + 40);
    popup.show(parent);
    popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

    cardToken.setCard(card);
    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    FadeTransition animation = new FadeTransition(Duration.seconds(delay), cardToken);
    animation.setOnFinished(this::secondTransition);
    animation.setFromValue(0);
    animation.setToValue(0);
    animation.play();
}
ViewPlayer.java 文件源码 项目:UFMGame 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Method to load the viewplayer popup
 * @param inputPlayer player to be displayed in the popup
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start(Player inputPlayer) throws IOException {
    player = inputPlayer;
    if(player != null){
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Class.class
            .getResource("/data/gui/pages-game/ViewPlayer.fxml"));
        page = (AnchorPane) loader.load();
        FadeTransition ft = new FadeTransition(Duration.millis(900), page);
        ft.setFromValue(0.0);
        ft.setToValue(0.97);
        ft.play();
        popup = new Popup();
        popup.setAutoHide(true);
        popup.getContent().add(page);
        popup.show(Main.stage);
    }
}
SaveGameController.java 文件源码 项目:UFMGame 阅读 18 收藏 0 点赞 0 评论 0
/**
 * THe start method to load the Save game dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Class.class
            .getResource("/data/gui/pages-game/SaveGameDialog.fxml"));
    page = (AnchorPane) loader.load();
    FadeTransition ft = new FadeTransition(Duration.millis(900), page);
    ft.setFromValue(0.0);
    ft.setToValue(0.97);
    ft.play();
    page.setOpacity(0.85);
    popup = new Popup();
    popup.setAutoHide(true);
    popup.getContent().add(page);
    popup.show(Main.stage);
}
Popupscreen.java 文件源码 项目:UFMGame 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Creates the popup screen and displays it
 */
public static void start(){
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Class.class
            .getResource("/data/gui/pages-game/Popup.fxml"));
    try {
        page = (AnchorPane) loader.load();
    } catch (IOException e) {
        e.printStackTrace();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(900), page);
    ft.setFromValue(0.0);
    ft.setToValue(0.97);
    ft.play();
    popup = new Popup();
    popup.setAutoHide(true);
    popup.getContent().add(page);
    popup.show(Main.stage);
}
OverwriteController.java 文件源码 项目:UFMGame 阅读 22 收藏 0 点赞 0 评论 0
/**
 * THe start method to load the are you sure to overwrite dialog
 * 
 * @param slot
 *            in where is game is saved
 * 
 * @throws IOException
 *             is thrown if the FXML file cannot be parsed.
 */
public static void start(int slot) throws IOException {
    saveslot = slot;
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Class.class
            .getResource("/data/gui/pages-game/OverwriteDialog.fxml"));
    page = (AnchorPane) loader.load();
    FadeTransition ft = new FadeTransition(Duration.millis(900), page);
    ft.setFromValue(0.0);
    ft.setToValue(0.97);
    ft.play();
    page.setOpacity(0.85);
    popup = new Popup();
    popup.setAutoHide(true);
    popup.getContent().add(page);
    popup.show(Main.stage);
}
ResultRoundDialogcontroller.java 文件源码 项目:UFMGame 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Loads the result of a round dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException{
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Class.class
            .getResource("/data/gui/pages-game/ResultRoundDialog.fxml"));
    page = (AnchorPane) loader.load();
    FadeTransition ft = new FadeTransition(Duration.millis(900), page);
    ft.setFromValue(0.0);
    ft.setToValue(0.97);
    ft.play();
    popup = new Popup();
    popup.setAutoHide(true);
    page.setOpacity(0.85);
    popup.getContent().add(page);
    popup.show(Main.stage);
    TeamBuilderController.start();
}
LoadGameController.java 文件源码 项目:UFMGame 阅读 21 收藏 0 点赞 0 评论 0
/**
 * THe start method to load the loadgame dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Class.class
            .getResource("/data/gui/pages-menu/LoadGameDialog.fxml"));
    page = (AnchorPane) loader.load();
    FadeTransition ft = new FadeTransition(Duration.millis(900), page);
    ft.setFromValue(0.0);
    ft.setToValue(0.97);
    ft.play();

    page.setOpacity(0.85);
    popup = new Popup();
    popup.setAutoHide(true);
    popup.getContent().add(page);
    popup.show(Main.stage);
}
PopUpPositioningDemo.java 文件源码 项目:javafx-demos 阅读 19 收藏 0 点赞 0 评论 0
public void showPopupWithinBounds(final Node node, final Popup popup) {
    final Window window = node.getScene().getWindow();
    double x = window.getX() + node.localToScene(0, 0).getX() + node.getScene().getX();
    double y = window.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getBoundsInParent().getHeight();
    popup.show(window, x, y);
    if (!popup.getContent().isEmpty()) {
        final Node content = popup.getContent().get(0);
        x -= content.localToScene(0, 0).getX();
        y -= content.localToScene(0, 0).getY();
    }
    Point2D pd= new Point2D(x, y);

    double Z = window.getX();
    double gX = sp.getLayoutX();
    double c = sp.getWidth()-popup.getWidth();

    popup.show(window, (Z+gX+c+8), y);
}
PopUpPositioningDemo.java 文件源码 项目:javafx-demos 阅读 18 收藏 0 点赞 0 评论 0
public Point2D showPopUp(final Node node, final Popup popup){
        final Parent parent = node.getParent();
        final Bounds childBounds = node.getBoundsInParent();

        double x = 0;
        double y = 0;
        if (null != parent) {
            final Bounds parentBounds = parent.localToScene(parent.getBoundsInLocal());
            x = childBounds.getMinX() + parentBounds.getMinX() + parent.getScene().getX()
                    + parent.getScene().getWindow().getX();
            y = childBounds.getMaxY() + parentBounds.getMinY() + parent.getScene().getY()
                    + parent.getScene().getWindow().getY();
        }

        Point2D pd= new Point2D(x, y);
        popup.show(node, x, y);
        return pd;

}
FXRobotHandler.java 文件源码 项目:fx-experience 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void sendToComponent(Object kb, final char ch, final boolean ctrl) {
  logger.trace("fire: {}", ch);

  final Window keyboardWindow = ((KeyboardPane) kb).getScene().getWindow();
  if (keyboardWindow != null) {
    final Scene scene;
    if (keyboardWindow instanceof Popup) {
      scene = ((Popup) keyboardWindow).getOwnerWindow().getScene();
    } else {
      scene = keyboardWindow.getScene();
    }

    Platform.runLater(() -> send(scene, ch, ctrl));
  }
}
FXRobotHandler.java 文件源码 项目:jointry 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void sendToComponent(Object kb, final char ch, final boolean ctrl) {
    logger.trace("fire: {}", ch);

    final Window keyboardWindow = ((KeyboardPane) kb).getScene().getWindow();
    if (keyboardWindow != null) {
        final Scene scene;
        if (keyboardWindow instanceof Popup) {
            scene = ((Popup) keyboardWindow).getOwnerWindow().getScene();
        } else {
            scene = keyboardWindow.getScene();
        }

        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                send(scene, ch, ctrl);
            }
        });
    }
}
MainFXMLDocumentController.java 文件源码 项目:xpanderfx 阅读 30 收藏 0 点赞 0 评论 0
/**
 * initialize the top side of the app
 */
private void topSideInit() {

    this.ICON.setGraphic(this.getImage("/resources/image/icon.png", 57));
    this.EXITER.setGraphic(this.getImage("/resources/image/exit.png", 57));
    this.MINIMISER.setGraphic(this.getImage("/resources/image/mini.png", 57));
    about = new Popup();
    help = new Popup();

}
MainFXMLDocumentController.java 文件源码 项目:xpanderfx 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 
 * @param pp 
 */
private void popupCloser(Popup pp, Node node) {     
    ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
    st.setToX(0);
    st.setToY(0);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.3), node);
    fd.setToValue(.2);
    fd.play();
    st.setOnFinished(e -> pp.hide());
}
AboutFXMLDocumentController.java 文件源码 项目:xpanderfx 阅读 21 收藏 0 点赞 0 评论 0
public void oakyButtonHandler(MouseEvent event, Popup pp) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.3), (Node) pp.getContent());
    st.setToX(0);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.3), (Node) pp.getContent());
    fd.setToValue(.2);
    st.setOnFinished(e -> pp.hide());
}
ClipboardNotification.java 文件源码 项目:Clipcon-Client 阅读 22 收藏 0 点赞 0 评论 0
protected void showPopup() {
    init();

    isShowing = true;

       VBox popupLayout = new VBox();
       popupLayout.setSpacing(10);
       popupLayout.setPadding(new Insets(10, 10, 10, 10));

       StackPane popupContent = new StackPane();
       popupContent.setPrefSize(width, height);
       popupContent.getStyleClass().add("notification");
       popupContent.getChildren().addAll(popupLayout);

       popup = new Popup();
       popup.setX(getX());
       popup.setY(getY());
       popup.getContent().add(popupContent);
       popup.addEventHandler(MouseEvent.MOUSE_PRESSED, new WeakEventHandler<>(event -> {
           fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.NOTIFICATION_PRESSED));
           hidePopUp();
       }));            
       popups.add(popup);

       // Add a timeline for popup fade out
       KeyValue fadeOutBegin = new KeyValue(popup.opacityProperty(), 1.0);            
       KeyValue fadeOutEnd   = new KeyValue(popup.opacityProperty(), 0.0);

       KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
       KeyFrame kfEnd   = new KeyFrame(popupAnimationTime, fadeOutEnd);

       timeline = new Timeline(kfBegin, kfEnd);
       timeline.setDelay(popupLifetime);
       timeline.setOnFinished(actionEvent -> Platform.runLater(() -> {
        hidePopUp();
       }));

       if (stage.isShowing()) {
           stage.toFront();
       } else {
           stage.show();
       }

       popup.show(stage);
       fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.SHOW_NOTIFICATION));
       timeline.play();
}
GargoyleNotification.java 文件源码 项目:Gargoyle 阅读 21 收藏 0 点赞 0 评论 0
private void addPopupToMap(Pos p, Popup popup) {
    List<Popup> popups;
    if (!popupsMap.containsKey(p)) {
        popups = new LinkedList<>();
        popupsMap.put(p, popups);
    } else {
        popups = popupsMap.get(p);
    }

    doAnimation(p, popup);

    // add the popup to the list so it is kept in memory and can be
    // accessed later on
    popups.add(popup);
}
GargoyleNotification.java 文件源码 项目:Gargoyle 阅读 38 收藏 0 点赞 0 评论 0
@Override
protected void interpolate(double frac) {
    Popup popup = popupWeakReference.get();
    if (popup != null) {
        double newAnchorY = oldAnchorY + distance * frac;
        popup.setAnchorY(newAnchorY);
    }
}
Notifications.java 文件源码 项目:yfiton 阅读 25 收藏 0 点赞 0 评论 0
private void addPopupToMap(Pos p, Popup popup) {
    List<Popup> popups;
    if (!popupsMap.containsKey(p)) {
        popups = new LinkedList<>();
        popupsMap.put(p, popups);
    } else {
        popups = popupsMap.get(p);
    }

    doAnimation(p, popup);

    // add the popup to the list so it is kept in memory and can be
    // accessed later on
    popups.add(popup);
}
WaitingRoomsManagerController.java 文件源码 项目:JavaFX_Game_Client 阅读 19 收藏 0 点赞 0 评论 0
/**
 * handle all popUp windows
 * 
 * @param text
 */
public void handlePopup(String text) {
    Platform.runLater(() -> {

        try {
            Popup popup = new Popup();

            Parent parent;

            parent = FXMLLoader.load(getClass().getResource("/Fxml/popup.fxml"));
            ImageView imageView = (ImageView) parent.lookup("#imgMessage");
            imageView.setImage(new Image(getClass().getResource("/Css/dialog-info.png").toString()));
            imageView.setOnMouseClicked(event -> popup.hide());
            Label lblMessage = (Label) parent.lookup("#lblMessage");
            lblMessage.setText(text);

            popup.setX(primaryStage.getX());
            popup.setY(primaryStage.getY());

            popup.getContent().add(parent);
            popup.setAutoHide(true);
            popup.show(primaryStage);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    });
}
LoginController.java 文件源码 项目:JavaFX_Game_Client 阅读 28 收藏 0 点赞 0 评论 0
/**
 * popUp windows
 * 
 * @param text
 */
public void handlePopup(String text) {
    Platform.runLater(() -> {

        try {
            Popup popup = new Popup();

            Parent parent;

            parent = FXMLLoader.load(getClass().getResource("/Fxml/popup.fxml"));
            ImageView imageView = (ImageView) parent.lookup("#imgMessage");
            imageView.setImage(new Image(getClass().getResource("/Css/dialog-info.png").toString()));
            imageView.setOnMouseClicked(event -> popup.hide());
            Label lblMessage = (Label) parent.lookup("#lblMessage");
            lblMessage.setText(text);

            // set the popup window position
            popup.setX(primaryStage.getX());
            popup.setY(primaryStage.getY());

            popup.getContent().add(parent);
            popup.setAutoHide(true);
            popup.show(primaryStage);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    });
}
GameRoomController.java 文件源码 项目:JavaFX_Game_Client 阅读 20 收藏 0 点赞 0 评论 0
/**
 * popUp windows
 * 
 * @param text
 */
public void handlePopup(String text) {
    Platform.runLater(() -> {

        try {
            Popup popup = new Popup();

            Parent parent;

            parent = FXMLLoader.load(getClass().getResource("/Fxml/popup.fxml"));
            ImageView imageView = (ImageView) parent.lookup("#imgMessage");
            imageView.setImage(new Image(getClass().getResource("/Css/dialog-info.png").toString()));
            imageView.setOnMouseClicked(event -> popup.hide());
            Label lblMessage = (Label) parent.lookup("#lblMessage");
            lblMessage.setText(text);

            popup.setX(primaryStage.getX());
            popup.setY(primaryStage.getY());

            popup.getContent().add(parent);
            popup.setAutoHide(true);
            popup.show(primaryStage);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    });
}


问题


面经


文章

微信
公众号

扫码关注公众号