gridpane

TilePane with automatically stretching tiles in JavaFX

左心房为你撑大大i 提交于 2019-12-01 19:35:51
问题 Is there any way in JavaFX to take best from both TilePane or FlowPane and GridPane? Here's what I'd like to achieve: First, I like the idea of GridPane where I can set up a M×N grid which automatically resizes within its parent container to divide the space equally into M columns and N rows. Then I can put some child elements which fill each cell completely, and they will stretch along with the grid. This is cool. But there's one drawback: I need to explicitly specify where should each

How to display GridPane object grid lines permanently, and without using the setGridLinesVisible() method?

∥☆過路亽.° 提交于 2019-12-01 17:25:58
Is it possible to make all GridPane's grid lines permanently visible without using setGridLinesVisible() ? I know that setGridLinesVisible() is for debugging purposes only, and I want to show grid lines for the end-user's convenience. Also, I need to work on a Pane container and not a Canvas. My program is able to add, delete, modify, move, etc. shape objects and groups on a Pane type or a Pane subtype parent container. Thanks Doing this depends a bit on how you have things set up. From the description of your application, when I've experimented with similar things I always found it convenient

How to display GridPane object grid lines permanently, and without using the setGridLinesVisible() method?

心不动则不痛 提交于 2019-12-01 16:57:34
问题 Is it possible to make all GridPane's grid lines permanently visible without using setGridLinesVisible() ? I know that setGridLinesVisible() is for debugging purposes only, and I want to show grid lines for the end-user's convenience. Also, I need to work on a Pane container and not a Canvas. My program is able to add, delete, modify, move, etc. shape objects and groups on a Pane type or a Pane subtype parent container. Thanks 回答1: Doing this depends a bit on how you have things set up. From

Javafx - Determine position of cursor on right click relative to gridpane

人盡茶涼 提交于 2019-12-01 13:04:45
问题 I have a 40x40 gridpane, displaying a map. Currently, i have the following methods listening for a right click: //detect right click + display menu, select if you want to place item 1 or item 2 final ContextMenu cm = new ContextMenu(); cm.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton() == MouseButton.SECONDARY) event.consume(); } }); cm.setOnAction(new EventHandler<ActionEvent>() { @Override

Dynamically add elements to a fixed-size GridPane in JavaFX

喜夏-厌秋 提交于 2019-12-01 11:38:43
I would like to display a grid containing a various number of rectangles in JavaFX. It is important that this grid cannot be resized. I chose the GridPane layout. I dynamically add javafx.scene.shape.Rectangle to it. Here's how my grid looks like with 2 rows and 4 columns. Upon resizing, I would like it to keep the same overall shape, that is to say each Rectangle having the same size and keeping an horizontal and vertical gaps between my Rectangle s. However, here's what I get with a 4x4 grid: The problems being: The last row and last column do not have the same size as the rest of the