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

TjfxFactory.java 文件源码 项目:optimal-spyglass-open-source 阅读 19 收藏 0 点赞 0 评论 0
public Popup setupDialog(double width, double height, Node content) {
    Popup popup = new Popup();
    if (height != -1) {
        popup.setHeight(height);
    }
    if (width != -1) {
        popup.setWidth(width);
    }

    popup.getContent().add(content);

    return popup;
}
RadialDebug.java 文件源码 项目:jfx.radialmenu 阅读 20 收藏 0 点赞 0 评论 0
public RadialDebug(Popup popup, Params params) {
    this.popup = popup;
    this.params = params;

    Circle centerPoint = new Circle();
    setupCircle(centerPoint, params.getAnchorPoint().xProperty(), params.getAnchorPoint().yProperty(), 1.0d);
    decorateShape(centerPoint, null, Color.RED, 1);

    popup.getContent().add(centerPoint);

}
Notifications.java 文件源码 项目:yfiton 阅读 27 收藏 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);
}
JoustToken.java 文件源码 项目:metastone 阅读 23 收藏 0 点赞 0 评论 0
public JoustToken(GameBoardView boardView, Card card, boolean up, boolean won) {
    Window parent = boardView.getScene().getWindow();
    this.cardToken = new CardTooltip();

    popup = new Popup();
    popup.getContent().setAll(cardToken);
    popup.setX(parent.getX() + 600);
    popup.show(parent);
    int offsetY = up ? -200 : 100;
    popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5 + offsetY);

    cardToken.setCard(card);

    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    FadeTransition animation = new FadeTransition(Duration.seconds(1.0), cardToken);
    animation.setDelay(Duration.seconds(1f));
    animation.setOnFinished(this::onComplete);
    animation.setFromValue(1);
    animation.setToValue(0);
    animation.play();

    if (won) {
        ScaleTransition scaleAnimation = new ScaleTransition(Duration.seconds(0.5f), cardToken);
        scaleAnimation.setByX(0.1);
        scaleAnimation.setByY(0.1);
        scaleAnimation.setCycleCount(2);
        scaleAnimation.setAutoReverse(true);
        scaleAnimation.play();  
    }
}
CodeAreaBuilder.java 文件源码 项目:mongofx 阅读 19 收藏 0 点赞 0 评论 0
public CodeAreaBuilder setupAutocomplete(AutocompletionEngine service, String collectionName) {
  this.suggestContext = new SuggestContext(collectionName, codeArea);
  Popup popup = new Popup();
  popup.setAutoHide(true);
  popup.setHideOnEscape(true);

  ListView<Suggest> listView = createAutocompleteListView(popup);
  popup.getContent().add(listView);
  codeArea.setPopupWindow(popup);
  codeArea.setPopupAlignment(PopupAlignment.CARET_BOTTOM);
  codeArea.setPopupAnchorOffset(new Point2D(1, 1));

  Builder<KeyEvent> onKey =
      EventHandlerHelper.on(keyPressed(KeyCode.SPACE, KeyCombination.CONTROL_DOWN)).act(ae -> {
        if (popup.isShowing()) {
          popup.hide();
        }
        else {
          showPopup(service, popup, listView);
        }
      }) //
      .on(EventPattern.keyReleased(KeyCode.PERIOD)).act(ae -> showPopup(service, popup, listView));

  codeArea.textProperty().addListener(text -> {
    if (popup.isShowing()) {
      updateSuggestion(service, popup, listView);
    }
  });
  EventHandler<KeyEvent> onKeyHandler = onKey.create();
  EventHandlerHelper.install(codeArea.onKeyPressedProperty(), onKeyHandler);
  EventHandlerHelper.install(codeArea.onKeyReleasedProperty(), onKeyHandler);
  return this;
}
CodeAreaBuilder.java 文件源码 项目:mongofx 阅读 21 收藏 0 点赞 0 评论 0
private boolean updateSuggestion(AutocompletionEngine service, Popup popup, ListView<Suggest> listView) {
  List<Suggest> autocompleteList = buildAutocompleteFromPosition(service);
  if (!autocompleteList.isEmpty()) {
    listView.getItems().setAll(autocompleteList);
    listView.getSelectionModel().select(0);
    return true;
  }
  popup.hide();
  return false;
}
CodeAreaBuilder.java 文件源码 项目:mongofx 阅读 23 收藏 0 点赞 0 评论 0
private ListView<Suggest> createAutocompleteListView(Popup popup) {
  ListView<Suggest> listView = new SuggestListView();

  Builder<KeyEvent> popupKeyEvents =
      EventHandlerHelper.on(keyPressed(KeyCode.ESCAPE)).act(e -> popup.hide())//
      .on(keyPressed(KeyCode.ENTER)).act(e -> applySelected(popup, listView));
  EventHandlerHelper.install(listView.onKeyPressedProperty(), popupKeyEvents.create());

  listView.setOnMouseClicked(e -> {
    if (e.getClickCount() == 2) applySelected(popup, listView);
  });

  return listView;
}
CodeAreaBuilder.java 文件源码 项目:mongofx 阅读 19 收藏 0 点赞 0 评论 0
private void applySelected(Popup popup, ListView<Suggest> listView) {
  Suggest selectedItem = listView.getSelectionModel().getSelectedItem();
  if (selectedItem != null) {
    selectedItem.apply(suggestContext);
  }
  popup.hide();
}
PopUpPositioningDemo.java 文件源码 项目:javafx-demos 阅读 21 收藏 0 点赞 0 评论 0
private void showPopUp(StackPane sp3){
    Popup p = getPopUp();
    //p.show(sp3,0,0);
    showPopupWithinBounds(sp3, p);
    //Point2D pd =  showPopUp(sp3, p);
    //System.out.println(p.getWidth());

    //p.show(window, x, y);
}
PopUpPositioningDemo.java 文件源码 项目:javafx-demos 阅读 22 收藏 0 点赞 0 评论 0
public void showPopupBelowNode(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);
    popup.show(window, x, y);
}


问题


面经


文章

微信
公众号

扫码关注公众号