javafx.scene.Parent类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(490)

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

Parent介绍

暂无

代码示例

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

for (Node child : nodes.getChildrenUnmodifiable()) {

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

private static void setConstraint(Node node, Object key, Object value) {
  if (value == null) {
    node.getProperties().remove(key);
  } else {
    node.getProperties().put(key, value);
  }
  if (node.getParent() != null) {
    node.getParent().requestLayout();
  }
}

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

((Parent) child).layout();
double alignedWidth = alignToChild.getLayoutBounds().getWidth();
double alignedX = alignToChild.getLayoutX();

代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg

private void removeEmptyGroups() {
  for (Parent p : emptyParents) {
    Parent parent = p.getParent();
    Group g = (Group) parent;
    g.getChildren().addAll(p.getChildrenUnmodifiable());
    g.getChildren().remove(p);
  }
}

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

public static Node getFirstTargetNode(Parent p) {
  if (p == null || isDisabledOrInvisible(p)) return null;
  final ParentTraversalEngine impl_traversalEngine = p.getImpl_traversalEngine();
  if (impl_traversalEngine!= null && impl_traversalEngine.canTraverse()) {
    Node selected = impl_traversalEngine.selectFirst();
    if (selected != null) {
      return selected;
    }
  }
  List<Node> parentsNodes = p.getChildrenUnmodifiable();
  for (Node n : parentsNodes) {
    if (isDisabledOrInvisible(n)) continue;
    final ParentTraversalEngine parentEngine = n instanceof Parent ? ((Parent)n).getImpl_traversalEngine() : null;
    if (parentEngine != null ? parentEngine.isParentTraversable() : n.isFocusTraversable()) {
      return n;
    }
    if (n instanceof Parent) {
      Node result = getFirstTargetNode((Parent)n);
      if (result != null) return result;
    }
  }
  return null;
}

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

@SuppressWarnings("deprecation")
private static void registerTraversalEngine(final Parent parent,
    final TraversalEngine te) {
  parent.setImpl_traversalEngine(te);
  for (Node child : parent.getChildrenUnmodifiable()) {
    if (child instanceof Parent) {
      registerTraversalEngine((Parent) child, te);
    }
  }
  if (parent instanceof TitledPane) {
    final TitledPane tp = (TitledPane) parent;
    if (tp.getContent() instanceof Parent) {
      registerTraversalEngine((Parent) tp.getContent(), te);
    }
  }
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

public static void addToNode(Parent node ){
  node.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm());
}

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

result.addAll(((Parent) n).getStylesheets());
result.addAll(p.getStylesheets());
  scene = p.getScene();

代码示例来源:origin: com.cedarsoft.commons/javafx

private InfoPopup(@Nonnull String message) {
 setAutoHide(true);
 setAutoFix(true);
 Parent root = createContent(message);
 root.getStylesheets().add(getClass().getResource("InfoPopupService.css").toExternalForm());
 root.getStyleClass().add("sick-uiglv2");
 root.getStyleClass().add("info-popup");
 getContent().add(root);
}

代码示例来源:origin: org.tentackle/tentackle-fx

T controller = (T) controllers.get(controllerClass);
if (controller != null) {
 if (controller.getView().isVisible()) {
  throw new FxRuntimeException(controllerClass + " is a singleton and already visible");
  view.getStylesheets().add(cssUrl.toExternalForm());

代码示例来源:origin: org.tentackle/tentackle-fx

@Override
public Stage getStage() {
 Stage stage = null;
 Scene scene = getView().getScene();
 if (scene != null && scene.getRoot() == getView()) {
  Window window = scene.getWindow();
  if (window instanceof Stage) {
   stage = (Stage) window;
  }
 }
 return stage;
}

代码示例来源:origin: org.controlsfx/controlsfx

private static DecorationPane getDecorationPaneInParentHierarchy(Node target) {
    Parent p = target.getParent();
    while (p != null) {
      if (p instanceof DecorationPane) {
        return (DecorationPane) p;
      }
      p = p.getParent();
    }
    return null;
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

public static void injectPane(Parent parent, Parent injectedParent, boolean useReflection) {
  if (parent == null) {
    throw new IllegalArgumentException("parent can not be null"); //$NON-NLS-1$
  }
  
  List<Node> ownerParentChildren = getChildren(parent.getParent(), useReflection);
  
  // we've got the children list, now we need to insert a temporary
  // layout container holding our dialogs and opaque layer / effect
  // in place of the owner (the owner will become a child of the dialog
  // stack)
  int ownerPos = ownerParentChildren.indexOf(parent);
  ownerParentChildren.remove(ownerPos);
  ownerParentChildren.add(ownerPos, injectedParent);
  
  // now we install the parent as a child of the injectedParent
  getChildren(injectedParent, useReflection).add(0, parent);
  
  // copy in layout properties, etc, so that the dialogStack displays
  // properly in (hopefully) whatever layout the owner node is in
  injectedParent.getProperties().putAll(parent.getProperties());
}

代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg

groupsTotal++;
Parent p = (Parent) node;
for (Node n : p.getChildrenUnmodifiable()) {
  optimize(n);
  Parent parent = p.getParent();
  if (parent instanceof Group) {
    trEmpty++;

代码示例来源:origin: com.guigarage/ui-basics

public static void addToParent(Parent parent) {
    parent.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm());
  }
}

代码示例来源:origin: de.roskenet/springboot-javafx-test

@Override
public void start(Stage stage) throws Exception {
  Preconditions.checkNotNull(viewBean, "No view to set up! Have you called init() before?");
  
  Scene scene = viewBean.getView().getScene();
  
  if (scene == null) {
    Scene x = new Scene(viewBean.getView());
    stage.setScene(x);
  }
  else {
    stage.setScene(scene);
  }
  stage.show();
}

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

/**
 * Returns all ancestors of the specified node till the specified one is
 * reached.
 *
 * @param n scene graph node
 * @param parent scene graph parent
 * @return a list that contains all ancestors of the specified node
 */
public static List<Parent> getAncestors(Node n, Parent parent) {
  List<Parent> nParents = new ArrayList<>();
  Parent p = n.getParent();
  while (p != null && p != parent) {
    nParents.add(p);
    p = p.getParent();
  }
  return nParents;
}

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

parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() {
  @Override
  public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) {
for (Node component : parent.getChildrenUnmodifiable()) {
  if (component instanceof Pane) {
    ((Pane) component).getChildren().addListener(new ListChangeListener<Node>() {

代码示例来源:origin: com.airhacks/afterburner.fx

void addCSSIfAvailable(Parent parent) {
  URL uri = getClass().getResource(getStyleSheetName());
  if (uri == null) {
    return;
  }
  String uriToCss = uri.toExternalForm();
  parent.getStylesheets().add(uriToCss);
}

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

@Override
protected void layoutChildren() {
  getParent().requestLayout();
  super.layoutChildren();
  for (Node n : getManagedChildren()) {
    if (n instanceof Region) {
      Region p = (Region) n;
      double width = Math.max(p.getMinWidth(), p.getPrefWidth());
      double height = Math.max(p.getMinHeight(), p.getPrefHeight());
      n.resize(width, height);
      double nX = Math.min(0, n.getLayoutX());
      double nY = Math.min(0, n.getLayoutY());
      n.relocate(nX, nY);
    }
  }
}

相关文章