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

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

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

Node.lookup介绍

暂无

代码示例

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

  1. private void showAutocompletePopup(int insertionIndex, String input) {
  2. CompletionResultSource suggestionMaker = mySuggestionProvider.get();
  3. List<MenuItem> suggestions =
  4. suggestionMaker.getSortedMatches(input, 5)
  5. .map(result -> {
  6. Label entryLabel = new Label();
  7. entryLabel.setGraphic(result.getTextFlow());
  8. entryLabel.setPrefHeight(5);
  9. CustomMenuItem item = new CustomMenuItem(entryLabel, true);
  10. item.setUserData(result);
  11. item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName()));
  12. return item;
  13. })
  14. .collect(Collectors.toList());
  15. autoCompletePopup.getItems().setAll(suggestions);
  16. myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length())
  17. .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY()));
  18. Skin<?> skin = autoCompletePopup.getSkin();
  19. if (skin != null) {
  20. Node fstItem = skin.getNode().lookup(".menu-item");
  21. if (fstItem != null) {
  22. fstItem.requestFocus();
  23. }
  24. }
  25. }

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

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

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

  1. public void show(Node node) {
  2. if (text == null) {
  3. text = (Text) node.lookup(".text");
  4. }
  5. node = text;
  6. if (!isShowing()) {
  7. if (node.getScene() == null || node.getScene().getWindow() == null) {
  8. throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
  9. }
  10. Window parent = node.getScene().getWindow();
  11. this.show(parent, parent.getX() +
  12. node.localToScene(0, 0).getX() +
  13. node.getScene().getX(),
  14. parent.getY() + node.localToScene(0, 0).getY() +
  15. node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
  16. ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
  17. } else {
  18. // if already showing update location if needed
  19. Window parent = node.getScene().getWindow();
  20. this.show(parent, parent.getX() +
  21. node.localToScene(0, 0).getX() +
  22. node.getScene().getX(),
  23. parent.getY() + node.localToScene(0, 0).getY() +
  24. node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
  25. }
  26. }
  27. }

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

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

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

  1. @Override public void run() {
  2. if (node != null) {
  3. Node subNode = node.lookup(subNodeStyleClass);
  4. if (subNode != null) {
  5. withState(node.lookup(subNodeStyleClass), subNodeState);
  6. } else {
  7. System.err.println("node = " + node+" node.lookup("+subNodeStyleClass+") = " + subNode);
  8. }
  9. } else {
  10. System.err.println("node = " + node);
  11. }
  12. }
  13. });

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Node lookup(final String selector) {
  6. return node().lookup(selector);
  7. }

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

  1. @Override public void run() {
  2. final Node macRB2 = macWindowContent.lookup("#RadioButton2");
  3. macRB2.setMouseTransparent(true);
  4. macRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
  5. final Node windows7RB2 = windows7WindowContent.lookup("#RadioButton2");
  6. windows7RB2.setMouseTransparent(true);
  7. windows7RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
  8. final Node windows8RB2 = windows8WindowContent.lookup("#RadioButton2");
  9. windows8RB2.setMouseTransparent(true);
  10. windows8RB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
  11. final Node ubuntuRB2 = ubuntuWindowContent.lookup("#RadioButton2");
  12. ubuntuRB2.setMouseTransparent(true);
  13. ubuntuRB2.pseudoClassStateChanged(PseudoClass.getPseudoClass("focused"), true);
  14. }
  15. });

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

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

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

  1. /**
  2. * Updates node hierarchy with current values from resource bundles.
  3. *
  4. * @param node hierarchy root node
  5. */
  6. public void updateNodeHierarchy(Node node){
  7. for(String id : propertyMap.keySet()){
  8. Node target = node.lookup("#" + id);
  9. if(target != null){
  10. updateProperties(target, id);
  11. // special handling for popup controls
  12. if(target instanceof Control){
  13. Tooltip tl = ((Control)target).getTooltip();
  14. if(tl != null && propertyMap.containsKey(tl.getId())){
  15. updateProperties(tl, tl.getId());
  16. }
  17. }
  18. }
  19. }
  20. }

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

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

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

  1. public void show(Node node) {
  2. if (text == null) {
  3. text = (Text) node.lookup(".text");
  4. }
  5. node = text;
  6. if (!isShowing()) {
  7. if (node.getScene() == null || node.getScene().getWindow() == null) {
  8. throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
  9. }
  10. Window parent = node.getScene().getWindow();
  11. this.show(parent, parent.getX() +
  12. node.localToScene(0, 0).getX() +
  13. node.getScene().getX(),
  14. parent.getY() + node.localToScene(0, 0).getY() +
  15. node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
  16. ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
  17. } else {
  18. // if already showing update location if needed
  19. Window parent = node.getScene().getWindow();
  20. this.show(parent, parent.getX() +
  21. node.localToScene(0, 0).getX() +
  22. node.getScene().getX(),
  23. parent.getY() + node.localToScene(0, 0).getY() +
  24. node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
  25. }
  26. }
  27. }

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

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

相关文章

Node类方法