本文整理了Java中javafx.scene.Parent.getChildrenUnmodifiable()
方法的一些代码示例,展示了Parent.getChildrenUnmodifiable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parent.getChildrenUnmodifiable()
方法的具体详情如下:
包路径:javafx.scene.Parent
类名称:Parent
方法名:getChildrenUnmodifiable
暂无
代码示例来源:origin: pmd/pmd
for (Node child : nodes.getChildrenUnmodifiable()) {
代码示例来源: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: stackoverflow.com
private void handleFocusChangesStartingFromParentNode(Parent parentNode) {
for (Node node : parentNode.getChildrenUnmodifiable()) {
node.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
performHandling();
}
});
try{
handleFocusChangesStartingFromNode((Parent)node);
}catch(ClassCastException e){
}
}
}
代码示例来源:origin: com.guigarage/responsivefx
public static List<Node> getAllNodesInParent(Parent parent) {
List<Node> ret = new ArrayList<>();
for (Node child : parent.getChildrenUnmodifiable()) {
ret.add(child);
if (child instanceof Parent) {
ret.addAll(getAllNodesInParent((Parent) child));
}
}
return ret;
}
代码示例来源:origin: com.guigarage/ui-basics
public static List<Node> getAllNodesInParent(Parent parent) {
List<Node> ret = new ArrayList<>();
for (Node child : parent.getChildrenUnmodifiable()) {
ret.add(child);
if (child instanceof Parent) {
ret.addAll(getAllNodesInParent((Parent) child));
}
}
return ret;
}
代码示例来源:origin: org.loadui/testFx
private static void printGraph( Node root, String indent )
{
System.out.println( indent + root );
if( root instanceof Parent )
{
indent += " ";
for( Node child : ( ( Parent )root ).getChildrenUnmodifiable() )
{
printGraph( child, indent );
}
}
}
代码示例来源:origin: stackoverflow.com
Parent root = FXMLLoader.load(getClass().getResource("fileName.fxml"));
ObservableList<Node> nodes = root.getChildrenUnmodifiable();
String _id = "testButton";
for (Node node : nodes) {
if (node.getId().equals(_id)) {
return node;
}
}
return null;
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
for (Node n : tempChildren) { calcNoOfNodes(n); }
}
}
}
代码示例来源:origin: stackoverflow.com
public static ArrayList<Node> getAllNodes(Parent root) {
ArrayList<Node> nodes = new ArrayList<Node>();
addAllDescendents(root, nodes);
return nodes;
}
private static void addAllDescendents(Parent parent, ArrayList<Node> nodes) {
for (Node node : parent.getChildrenUnmodifiable()) {
nodes.add(node);
if (node instanceof Parent)
addAllDescendents((Parent)node, nodes);
}
}
代码示例来源:origin: com.cedarsoft.commons/javafx
private static void dump(Node node, PrintStream out, int depth) {
out.println(Strings.repeat(" ", depth) + node + " #" + node.getId());
Parent parent = (Parent) node;
parent.getChildrenUnmodifiable()
.forEach(child -> {
dump(child, out, depth + 1);
});
}
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
tempChildren.forEach(n -> calcNoOfNodes(n));
}
}
}
代码示例来源:origin: stackoverflow.com
if (node instanceof Parent) {
Parent parent = (Parent) node;
ObservableList<Node> children = parent.getChildrenUnmodifiable();
for (Node child : children) {
addListenerDeeply(child, listener);
代码示例来源:origin: com.airhacks/afterburner.fx
/**
* Scene Builder creates for each FXML document a root container. This
* method omits the root container (e.g. AnchorPane) and gives you the
* access to its first child.
*
* @return the first child of the AnchorPane
*/
public Node getViewWithoutRootContainer() {
final ObservableList<Node> children = getView().getChildrenUnmodifiable();
if (children.isEmpty()) {
return null;
}
return children.listIterator().next();
}
代码示例来源:origin: de.roskenet/springboot-javafx-support
/**
* Scene Builder creates for each FXML document a root container. This
* method omits the root container (e.g. {@link AnchorPane}) and gives you
* the access to its first child.
*
* @return the first child of the {@link AnchorPane} or null if there are no
* children available from this view.
*/
public Node getViewWithoutRootContainer() {
final ObservableList<Node> children = getView().getChildrenUnmodifiable();
if (children.isEmpty()) {
return null;
}
return children.listIterator().next();
}
代码示例来源:origin: com.guigarage/ui-basics
public static void registerRecursiveChildObserver(Window window, Consumer<Node> onRemove, Consumer<Node> onAdd) {
List<Node> allNodes = getAllNodesInWindow(window);
ListChangeListener<Node> listener = createRecursiveChildObserver(onRemove, onAdd);
for (Node child : allNodes) {
if (child instanceof Parent) {
Parent parent = (Parent) child;
parent.getChildrenUnmodifiable().addListener(listener);
}
}
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
public void validate(Node node) {
if (node instanceof MeshView) {
MeshView meshView = (MeshView) node;
validate(meshView.getMesh());
} else if (node instanceof Parent) {
for (Node child : ((Parent) node).getChildrenUnmodifiable()) {
validate(child);
}
}
}
代码示例来源:origin: com.guigarage/responsivefx
public static void registerRecursiveChildObserver(Window window, Consumer<Node> onRemove, Consumer<Node> onAdd) {
List<Node> allNodes = getAllNodesInWindow(window);
ListChangeListener<Node> listener = createRecursiveChildObserver(onRemove, onAdd);
for (Node child : allNodes) {
if (child instanceof Parent) {
Parent parent = (Parent) child;
parent.getChildrenUnmodifiable().addListener(listener);
}
}
}
代码示例来源: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: com.nexitia.emaginplatform/emagin-jfxcore-engine
public static void addListenerDeeply(Node node, EventHandler<MouseEvent> listener) {
node.addEventHandler(MouseEvent.MOUSE_MOVED, listener);
node.addEventHandler(MouseEvent.MOUSE_PRESSED, listener);
node.addEventHandler(MouseEvent.MOUSE_DRAGGED, listener);
node.addEventHandler(MouseEvent.MOUSE_EXITED, listener);
node.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, listener);
if (node instanceof Parent) {
Parent parent = (Parent) node;
ObservableList<Node> children = parent.getChildrenUnmodifiable();
for (Node child : children) {
addListenerDeeply(child, listener);
}
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
public static void addResizeListener(Stage stage) {
ResizeListener resizeListener = new ResizeListener(stage, null);
stage.getScene().addEventHandler(MouseEvent.MOUSE_MOVED, resizeListener);
stage.getScene().addEventHandler(MouseEvent.MOUSE_PRESSED, resizeListener);
stage.getScene().addEventHandler(MouseEvent.MOUSE_DRAGGED, resizeListener);
stage.getScene().addEventHandler(MouseEvent.MOUSE_EXITED, resizeListener);
stage.getScene().addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, resizeListener);
ObservableList<Node> children = stage.getScene().getRoot().getChildrenUnmodifiable();
for (Node child : children) {
// addListenerDeeply(child, resizeListener);
}
}
内容来源于网络,如有侵权,请联系作者删除!