Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.List;
- import javafx.scene.Node;
- import javafx.scene.layout.GridPane;
- public class SpecialGridPane extends GridPane {
- List<NodeParent> list = new ArrayList<>();
- public void addChild(int row, int column, Node node) {
- list.add(new NodeParent(row, column, node));
- setConstraints(node, column, row);
- getChildren().add(node);
- }
- public Node getChild(int row, int column) {
- for (NodeParent node : list) {
- if (node.getRow() == row && node.getColumn() == column)
- return node.getNode();
- }
- return null;
- }
- }
- class NodeParent {
- private int row;
- private int column;
- private Node node;
- public NodeParent(int row, int column, Node node) {
- this.row = row;
- this.column = column;
- this.node = node;
- }
- public int getRow() {
- return row;
- }
- public int getColumn() {
- return column;
- }
- public Node getNode() {
- return node;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement