pane

How to center a node within a pane javafx

…衆ロ難τιáo~ 提交于 2019-11-29 18:22:47
问题 How do I create a Pane and have a child Node put at the center? Lets say the Pane is 500 by 500 and the Node is an ImageView with a 200 by 200 Image ImageView view = new ImageView(); Image img = new Image("test.png"); view.setImage(img); Pane pane = new Pane(); pane.setMinWidth(500); pane.setMinHeight(500); pane.getChildren().add(view); 回答1: you have 2 choices : For example using StackPane instead of Pane (because you can use Pos) StackPane p = new StackPane(); p.setPrefSize(700,700); //set a

JavaFX Panel inside Panel auto resizing

别等时光非礼了梦想. 提交于 2019-11-28 03:55:09
I have a JavaFX application which has only one FXML file. In this file I have one AnchorPane which has a StackPane inside it. Here is the screenshot: When I start this application, I want to resize StackPane automatically with the AnchorPane. Thus; StackPane will get the current avaliable width and height automatically. At the moment when I resize the application, AnchorPane is being resized automatically but StackPane stays as his fixed size. How can I resize the StackPane automatically and make it fully stretched inside its parent panel? My Code Main.java package app; import javafx

How to draw arrow JavaFX? (pane)

淺唱寂寞╮ 提交于 2019-11-28 01:30:47
I need to make directed graph from undirected. I can draw line-Edge, but I don't know how to make arrow: public class Edge extends Group { protected Cell source; protected Cell target; Line line; public Edge(Cell source, Cell target) { this.source = source; this.target = target; source.addCellChild(target); target.addCellParent(source); line = new Line(); line.startXProperty().bind(source.layoutXProperty().add(source.getBoundsInParent().getWidth() / 2.0)); line.startYProperty().bind(source.layoutYProperty().add(source.getBoundsInParent().getHeight() / 2.0)); line.endXProperty().bind(target

JavaFX Panel inside Panel auto resizing

你离开我真会死。 提交于 2019-11-26 22:36:27
问题 I have a JavaFX application which has only one FXML file. In this file I have one AnchorPane which has a StackPane inside it. Here is the screenshot: When I start this application, I want to resize StackPane automatically with the AnchorPane. Thus; StackPane will get the current avaliable width and height automatically. At the moment when I resize the application, AnchorPane is being resized automatically but StackPane stays as his fixed size. How can I resize the StackPane automatically and

How to draw arrow JavaFX? (pane)

为君一笑 提交于 2019-11-26 21:54:19
问题 I need to make directed graph from undirected. I can draw line-Edge, but I don't know how to make arrow: public class Edge extends Group { protected Cell source; protected Cell target; Line line; public Edge(Cell source, Cell target) { this.source = source; this.target = target; source.addCellChild(target); target.addCellParent(source); line = new Line(); line.startXProperty().bind(source.layoutXProperty().add(source.getBoundsInParent().getWidth() / 2.0)); line.startYProperty().bind(source