fxml

JavaFX FXML Parameter passing from Controller A to B and back

旧时模样 提交于 2020-01-09 11:25:26
问题 I want to create a controller based JavaFX GUI consisting of multiple controllers. The task I can't accomplish is to pass parameters from one Scene to another AND back. Or in other words: The MainController loads SubController's fxml, passes an object to SubController, switches the scene. There shall not be two open windows. After it's work is done, the SubController shall then switch the scene back to the MainController and pass some object back. This is where I fail. This question is very

JavaFX FXML Parameter passing from Controller A to B and back

泪湿孤枕 提交于 2020-01-09 11:25:11
问题 I want to create a controller based JavaFX GUI consisting of multiple controllers. The task I can't accomplish is to pass parameters from one Scene to another AND back. Or in other words: The MainController loads SubController's fxml, passes an object to SubController, switches the scene. There shall not be two open windows. After it's work is done, the SubController shall then switch the scene back to the MainController and pass some object back. This is where I fail. This question is very

Java vs JavaFX Script vs FXML. Which is better way of programming in JavaFX?

拥有回忆 提交于 2020-01-09 07:47:08
问题 I am new to JavaFX and I come across 2-3 ways of designing UI in JavaFX. Simple Java file which is same methodology we used in Swing JavaFX Script which I don't know FXML which is xml based file for UI designing Which of these is better? and why? 回答1: Just to put some light, javafx script was used prior to javafx 2.0 and is no longer in use ! You can use this approach, if you are more familiar with the coding UI in java. But, I personally dislike the approach, since it makes the code complex

FXML Initialize() throws InvocationTargetException

心不动则不痛 提交于 2020-01-07 08:23:27
问题 Im trying to set the text of a button on the initialize() method but it throws me InvocationTargetException, its the same if I try to get any items on the FXML. FXML: <VBox fx:id="vbox" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="450.0" spacing="40.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="instaj.LoginController"> <children> <ImageView fitHeight="150

How do I create KeyEvents in Java FXML?

狂风中的少年 提交于 2020-01-07 03:27:11
问题 I created this small project to test key events. But when I press keys, it isn't behaving as I want. Actually I need key events for my Calculator project. I created a Calculator project and aside from mouse clicks, I want to add a feature where numbers or operators can be typed from a keyboard. Can anyone check this and help make it more functional? public class FXMLDocumentController implements Initializable{ @FXML private Label label; @FXML private Button backSpace; @FXML private Button

How to get data in one Java FXML Controller from another FXML Controller (these controllers are not nested controllers)? [duplicate]

妖精的绣舞 提交于 2020-01-06 14:00:16
问题 This question already has an answer here : How can I use a variable from another Controller in JavaFX (1 answer) Closed 6 years ago . I have one button in one FXML and two text fields in another FXML. These two FXMLs are independent, I mean they are not nested. I want to print the text (which are in the two text fields) in the console/output whenever there is a click in the button. Below are the fxmls and their controllers: Button.fxml <AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth=

How to get data in one Java FXML Controller from another FXML Controller (these controllers are not nested controllers)? [duplicate]

前提是你 提交于 2020-01-06 13:59:49
问题 This question already has an answer here : How can I use a variable from another Controller in JavaFX (1 answer) Closed 6 years ago . I have one button in one FXML and two text fields in another FXML. These two FXMLs are independent, I mean they are not nested. I want to print the text (which are in the two text fields) in the console/output whenever there is a click in the button. Below are the fxmls and their controllers: Button.fxml <AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth=

How to get data in one Java FXML Controller from another FXML Controller (these controllers are not nested controllers)? [duplicate]

巧了我就是萌 提交于 2020-01-06 13:59:37
问题 This question already has an answer here : How can I use a variable from another Controller in JavaFX (1 answer) Closed 6 years ago . I have one button in one FXML and two text fields in another FXML. These two FXMLs are independent, I mean they are not nested. I want to print the text (which are in the two text fields) in the console/output whenever there is a click in the button. Below are the fxmls and their controllers: Button.fxml <AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth=

“Exception in Application start method” when trying to launch GUI using FXML

喜你入骨 提交于 2020-01-06 08:08:40
问题 I'm working on a college project and I have to create a GUI. I'm trying to learn FXML but when trying to launch the GUI I get the following error: Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke

“Exception in Application start method” when trying to launch GUI using FXML

雨燕双飞 提交于 2020-01-06 08:08:02
问题 I'm working on a college project and I have to create a GUI. I'm trying to learn FXML but when trying to launch the GUI I get the following error: Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke