javafx.scene.Node.lookup()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(342)

本文整理了Java中javafx.scene.Node.lookup()方法的一些代码示例,展示了Node.lookup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.lookup()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:lookup

Node.lookup介绍

暂无

代码示例

代码示例来源:origin: pmd/pmd

private void showAutocompletePopup(int insertionIndex, String input) {
  CompletionResultSource suggestionMaker = mySuggestionProvider.get();
  List<MenuItem> suggestions =
    suggestionMaker.getSortedMatches(input, 5)
            .map(result -> {
              Label entryLabel = new Label();
              entryLabel.setGraphic(result.getTextFlow());
              entryLabel.setPrefHeight(5);
              CustomMenuItem item = new CustomMenuItem(entryLabel, true);
              item.setUserData(result);
              item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName()));
              return item;
            })
            .collect(Collectors.toList());
  autoCompletePopup.getItems().setAll(suggestions);
  myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length())
       .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY()));
  Skin<?> skin = autoCompletePopup.getSkin();
  if (skin != null) {
    Node fstItem = skin.getNode().lookup(".menu-item");
    if (fstItem != null) {
      fstItem.requestFocus();
    }
  }
}

代码示例来源:origin: stackoverflow.com

PopupWindow popupWindow = getPopupWindow();
Node popup = popupWindow.getScene().getRoot().getChildrenUnmodifiable().get(0);
StackPane hover = (StackPane) popup.lookup(".hover-square");
Rectangle rectH = (Rectangle) hover.getChildren().get(0);
Set<Node> squares = popup.lookupAll(".color-rect");

代码示例来源:origin: jfoenixadmin/JFoenix

public void show(Node node) {
    if (text == null) {
      text = (Text) node.lookup(".text");
    }
    node = text;
    if (!isShowing()) {
      if (node.getScene() == null || node.getScene().getWindow() == null) {
        throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
      }
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
      ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
    } else {
      // if already showing update location if needed
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
    }
  }
}

代码示例来源:origin: stackoverflow.com

if(root.getChildrenUnmodifiable().size()>0){
  Node popup = root.getChildrenUnmodifiable().get(0);
  if(popup.lookup(".combo-box-popup")!=null){

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void run() {
    if (node != null) {
      Node subNode = node.lookup(subNodeStyleClass);
      if (subNode != null) {
        withState(node.lookup(subNodeStyleClass), subNodeState);
      } else {
        System.err.println("node = " + node+" node.lookup("+subNodeStyleClass+") = " + subNode);
      }
    } else {
      System.err.println("node = " + node);
    }
  }
});

代码示例来源:origin: org.jrebirth.af/core

/**
 * {@inheritDoc}
 */
@Override
public Node lookup(final String selector) {
  return node().lookup(selector);
}

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void run() {
    final Node macRB2 = macWindowContent.lookup("#RadioButton2");
    macRB2.setMouseTransparent(true);
    macRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
    final Node windows7RB2 = windows7WindowContent.lookup("#RadioButton2");
    windows7RB2.setMouseTransparent(true);
    windows7RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
    final Node windows8RB2 = windows8WindowContent.lookup("#RadioButton2");
    windows8RB2.setMouseTransparent(true);
    windows8RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
    final Node ubuntuRB2 = ubuntuWindowContent.lookup("#RadioButton2");
    ubuntuRB2.setMouseTransparent(true);
    ubuntuRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
  }
});

代码示例来源:origin: io.datafx/flow

if (DataFXUtils.getPrivileged(field, controller) == null) {
  if (Node.class.isAssignableFrom(field.getType())) {
    Node toInject = n.lookup("#" + field.getName());
    if(toInject != null) {
      DataFXUtils.setPrivileged(field, controller, toInject);

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

/**
 * Updates node hierarchy with current values from resource bundles.
 * 
 * @param node hierarchy root node
 */
public void updateNodeHierarchy(Node node){
  for(String id : propertyMap.keySet()){
    Node target = node.lookup("#" + id);
    if(target != null){
      updateProperties(target, id);
      // special handling for popup controls
      if(target instanceof Control){
        Tooltip tl = ((Control)target).getTooltip();
        if(tl != null && propertyMap.containsKey(tl.getId())){
          updateProperties(tl, tl.getId());
        }
      }
      
    }
  }
}

代码示例来源:origin: com.aquafx-project/aquafx

macWindow.getStyleClass().add("macWindow");
macWindowContent = (Node)FXMLLoader.load(SimpleWindowPage.class.getResource("simple-window.fxml"));
macWindowContent.lookup("#MenuBar").setVisible(false);
macWindowContent.lookup("#MenuBar").setManaged(false);
macWindow.getChildren().add(macWindowContent);

代码示例来源:origin: com.jfoenix/jfoenix

public void show(Node node) {
    if (text == null) {
      text = (Text) node.lookup(".text");
    }
    node = text;
    if (!isShowing()) {
      if (node.getScene() == null || node.getScene().getWindow() == null) {
        throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
      }
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
      ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
    } else {
      // if already showing update location if needed
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
    }
  }
}

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

Node titlebar = newValue.getNode().lookup("." + getTitleBarStyleClass());

相关文章

微信公众号

最新文章

更多

Node类方法