javafx

javafx: attach ChoiceBox to a TableCell on a TableColumn during Edit

不羁的心 提交于 2020-01-05 02:47:41
问题 The code below are instance methods of an object. private StringProperty buySell; // getters public String getBuySell(){ return this.buySell.get(); } // return Property Object public StringProperty buySellProperty(){ return this.buySell; } // setters public void setBuySell(String buySell){ this.buySell.set(buySell); } In my Controller class, I have created a TableColumn for buySell string property with the code below. When I created a transaction, there will be a new row on the tableView .

Take a snapshot part of canvas in javaFX

荒凉一梦 提交于 2020-01-04 14:29:12
问题 I need to save some part of canvas to image that is from x1 > 0 and y1 > 0 to some x2 > x1 and y2 > y1 . What I understand from javaFX API, snapshot must occupy a whole area of node, like wim = new WritableImage(((int) width), ((int) height)); bufferedImage = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB); parameter = new SnapshotParameters(); parameter.setTransform(new Translate(0, 200)); and then node.snapshot(parameter, wim); image = SwingFXUtils.fromFXImage(wim,

How to get the size of a label before it is laid out?

坚强是说给别人听的谎言 提交于 2020-01-04 14:14:11
问题 I read this old answer on how to accomplish this. But since it involves using impl_processCSS(boolean) , a method that is now deprecated, I think we need to update the answer. I've tried placing the label inside a HBox and then get the size of it, or getting the size of the HBox, without any luck. And I've also tried using .label.getBoundsInLocal().getWidth(). SSCCE: import javafx.scene.control.Label; import javafx.scene.layout.HBox; import javafx.application.Application; import javafx.scene

How to do I align a Button to the bottom of a VBox in FXML?

戏子无情 提交于 2020-01-04 13:47:45
问题 I have some buttons inside of a VBox . I would like to align the last button to the bottom of the VBox. Is there any way to do this? I've tried this answer but it didn't work. Here is my code: <VBox fx:id="presetVBox" prefHeight="580.0" prefWidth="180.0" style="-fx-background-color: white;"> <padding> <Insets left="10.0" right="10.0"/> </padding> <Button fx:id="preset1Button" maxWidth="Infinity" mnemonicParsing="false" prefWidth="Infinity" text="Load Preset 1"> <VBox.margin> <Insets top="10.0

How to do I align a Button to the bottom of a VBox in FXML?

若如初见. 提交于 2020-01-04 13:47:02
问题 I have some buttons inside of a VBox . I would like to align the last button to the bottom of the VBox. Is there any way to do this? I've tried this answer but it didn't work. Here is my code: <VBox fx:id="presetVBox" prefHeight="580.0" prefWidth="180.0" style="-fx-background-color: white;"> <padding> <Insets left="10.0" right="10.0"/> </padding> <Button fx:id="preset1Button" maxWidth="Infinity" mnemonicParsing="false" prefWidth="Infinity" text="Load Preset 1"> <VBox.margin> <Insets top="10.0

JavaFX SceneBuilder ImageView not working

南笙酒味 提交于 2020-01-04 13:38:40
问题 I need to create a GUI with SceneBuilder. I added an ImageView to my interface and set the path to my image correctly. The image is showing inside SceneBuilder, but when I run my application, the image is not there. I put the image inside "img/placeholder.png", and then directly into my root directory. Doesn't matter where I put it, it isn't working. The path to my gui.fxml file: /src/gui/gui.fxml The path to my image file: /placeholder.png Can anybody help me please? 回答1: Another solution in

JavaFX SceneBuilder ImageView not working

混江龙づ霸主 提交于 2020-01-04 13:38:28
问题 I need to create a GUI with SceneBuilder. I added an ImageView to my interface and set the path to my image correctly. The image is showing inside SceneBuilder, but when I run my application, the image is not there. I put the image inside "img/placeholder.png", and then directly into my root directory. Doesn't matter where I put it, it isn't working. The path to my gui.fxml file: /src/gui/gui.fxml The path to my image file: /placeholder.png Can anybody help me please? 回答1: Another solution in

DirectoryChooser Javafx buged?

孤人 提交于 2020-01-04 11:13:52
问题 I'm using Directory Chooser for set a TextField with the selected path. If I choose some directory like Desktop, or any other folder it returns the path, BUT if I choose the directorys from my library like my Documents (C:\Users\Victor\Documents) it returns null. Is it a bug?? I'm using the code below: DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle("Selecione o diretório"); File defaultDirectory = new File(folderChooser); chooser.setInitialDirectory(defaultDirectory);

DirectoryChooser Javafx buged?

[亡魂溺海] 提交于 2020-01-04 11:13:17
问题 I'm using Directory Chooser for set a TextField with the selected path. If I choose some directory like Desktop, or any other folder it returns the path, BUT if I choose the directorys from my library like my Documents (C:\Users\Victor\Documents) it returns null. Is it a bug?? I'm using the code below: DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle("Selecione o diretório"); File defaultDirectory = new File(folderChooser); chooser.setInitialDirectory(defaultDirectory);

Cloning children of pane - JavaFX

孤街醉人 提交于 2020-01-04 07:47:11
问题 So I have a Pane with some components in it (Groups and Polygons) and I wanted to make a copy of this Pane, but whenever I do the following it seems like it deletes the children of the original Pane and transfers it to the new one. Pane pane1 = new Pane(); pane1.getChildren().addAll(poly1, poly2, poly3, group1, group2); Pane pane2 = new Pane(); pane2.getChildren().addAll(pane1.getChildren()); So my question is, how do you copy these children without removing them from the original Pane? 来源: