gridpane

randomly displaying circles within gridPane cells in javaFX

隐身守侯 提交于 2019-12-18 09:54:10
问题 I am creating am application that displays circles (of different colors) randomly within each cell of a gridPane. What i want to do is create a "shuffle" button that changes the position of each circle randomly within the gridPane. However, I keep running into a slurry of problems. Here is what i have so far. My two classes (have not added XML file): Controller Class public class viewController { //My two Variables, a gridPane and a button @FXML private GridPane matrix; @FXML private Button

How to obtain the information inside a gridpane (javaFX)

蹲街弑〆低调 提交于 2019-12-11 10:33:52
问题 I have a method that creates new TextFields in a gridPane (2x8). I was wondering, once they are created, how do I access the information within each index (as in: 0,0 - 1,0, etc). Here's the code: private void llenarGridJugadores(ArrayList<NodoJugadores> array) { if( (array.get(0).getCategoria() == 3) && (array.get(0).getSexo().equalsIgnoreCase("m")) ) { for(int i = 0 ; i < array.size() ; i++) { TextField text = new TextField(array.get(i).getNombre()); grid.add(text, i, 0); } } else if(

JavaFx Images in Gridpane slowing down performance drastically

南笙酒味 提交于 2019-12-10 18:03:50
问题 I want to create a GridPane (which is nested in a ScrollPane) where I add dynamically cells to the GridPane. Each cell contains a VBox with a BackgroundImage, a few Labels and a Checkbox. The Problem is, that the GridPane can contain several hundreds VBoxes, in my case there are about 300 VBoxes and with this many VBoxes the response time of the Gridpane gets really poor. When I click for instance on a CheckBox it takes a few seconds until the CheckBox is selected/unselected, which makes my

JavaFX tableview resize to fit window

拈花ヽ惹草 提交于 2019-12-05 14:48:23
问题 I am just trying out JavaFX and am forcing my way into it because it is suppose to be the future. I am trying to create a table with 4 columns. The columns AND THE TABLE should resize to fill the parent pane. I cannot for the life of me get this to work. I have been trying for over 4 hours now and the tableview does not resize. Here is my FXML file. <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?>

JavaFX continuous form dynamically add new row with content in gridpane

匆匆过客 提交于 2019-12-04 20:07:27
I need some help creating a continuous form with a gridpane like in ms access. Initially the gridpane has 1 row and 3 columns | Choicebox | Delete Button | Add Button | public class myGridpane { @FXML private GridPane gp_form; private List<Car> myCars = new ArrayList(); public void initialize() { myCars = loadCars(); initGridpane(myCars); } private initGridpane(List<Car> myCars) { int rowIndex = 0; for (Car myCar : myCars) { Button b_newCar = new Button("+"); Button b_deleteCar = new Button("-"); ChoiceBox<Car> cb_car = new ChoiceBox<>(); cb_car.setItems(Car.getAllCarKeys()); cb_car.setValue

JavaFX tableview resize to fit window

六眼飞鱼酱① 提交于 2019-12-04 02:19:05
I am just trying out JavaFX and am forcing my way into it because it is suppose to be the future. I am trying to create a table with 4 columns. The columns AND THE TABLE should resize to fill the parent pane. I cannot for the life of me get this to work. I have been trying for over 4 hours now and the tableview does not resize. Here is my FXML file. <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import java.net.*?> <?import javafx.geometry.*?> <?import javafx

adding images to a gridpane javafx

非 Y 不嫁゛ 提交于 2019-12-02 10:22:14
问题 I'm adding a list of images from a directory using an arraylist.When images are added,my ScrollPane gets crowded.How can I keep spacings between images ? here's my code File file = new File("D:\\SERVER\\Server Content\\Apps\\icons"); File[] filelist1 = file.listFiles(); ArrayList<File> filelist2 = new ArrayList<>(); hb = new HBox(); for (File file1 : filelist1) { filelist2.add(file1); } System.out.println(filelist2.size()); gridpane.setPadding(new Insets(50,50,50,50)); gridpane.setHgap(20);

JavaFX - Multiple Grid Panes - Only One is connecting, the rest are null

懵懂的女人 提交于 2019-12-02 06:31:11
In my JavaFX program I have multiple grid panes. The FXML code I have is here. <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.shape.*?> <?import javafx.geometry.*?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <AnchorPane id="AnchorPane" prefHeight="553.0" prefWidth="586.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pkg3dtictactoe.FXMLDocumentController"> <children> <VBox prefHeight="489.0" prefWidth="586.0"> <children> <MenuBar> <menus> <Menu

JavaFX - get index row and index col by OnClick on GridPane [duplicate]

只愿长相守 提交于 2019-12-02 06:27:42
This question already has an answer here: Javafx - Determine position of cursor on right click relative to gridpane 1 answer How to get GridPane Row and Column IDs on Mouse Entered in each cell of Grid in JavaFX? 1 answer JavaFX : How to get column and row index in gridpane? 1 answer I need to get the index of my specified click over my GridPane called myGrid. If I put a piece on board from my coord like here below, it works.. for example: myGrid.add(new ImageView("othello/images/white.png"), 4, 3); If I want to take the position of my click on board I use this method without success.. @FXML

adding images to a gridpane javafx

拥有回忆 提交于 2019-12-02 05:55:50
I'm adding a list of images from a directory using an arraylist.When images are added,my ScrollPane gets crowded.How can I keep spacings between images ? here's my code File file = new File("D:\\SERVER\\Server Content\\Apps\\icons"); File[] filelist1 = file.listFiles(); ArrayList<File> filelist2 = new ArrayList<>(); hb = new HBox(); for (File file1 : filelist1) { filelist2.add(file1); } System.out.println(filelist2.size()); gridpane.setPadding(new Insets(50,50,50,50)); gridpane.setHgap(20); gridpane.setVgap(20); int imageCol = 0; int imageRow = 0; for (int i = 0; i < filelist2.size(); i++) {