fxml

javafx how to get selected data from tableview using FXML

瘦欲@ 提交于 2019-12-20 06:14:20
问题 I am working on a project a i want to get the selected data of tableview but i am using FXML. I have codes for no-FXML but i am unable to use it for FXML. code: public class person1 { private final StringProperty firstName = new SimpleStringProperty(""); private final StringProperty surname = new SimpleStringProperty(""); private final StringProperty goodnameof1 = new SimpleStringProperty(""); public person1(String firstName) { setFirstName(firstName); } public String getFirstName() { return

JavaFX controller injection does not work

我与影子孤独终老i 提交于 2019-12-20 04:13:01
问题 I have two fxml files. I connect them with an include statement: The "main" fxml file looks like that: <?import javafx.geometry.*?> // ... <BorderPane prefHeight="962" prefWidth="1280" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MyMainController"> <center> <SplitPane dividerPositions="0.63" BorderPane.alignment="CENTER"> <items> <fx:include source="AnotherFile.fxml" /> // ... </items> </SplitPane> </center> <top> // ... </top> <

Block parent stage until child stage closes

旧街凉风 提交于 2019-12-20 03:07:18
问题 I have a controller on which an action event of my button opens a child stage. The issue is when I close the parent stage, the child stage also closes. I want to prevent parent stage from closing as long as child stage is open. URL url = getClass().getResource("Message.fxml"); FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(url); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory()); root = (Parent)fxmlLoader.load(url.openStream()); Stage stage = new Stage(); //stage

JavaFX 2.0 loading fxml files with event handlers fails

若如初见. 提交于 2019-12-20 02:39:07
问题 i am trying to load a fxml from a subfolder, but it fails. I have the line that make the replace scene content: private Parent replaceSceneContent(String fxml) throws Exception { Parent page = (Parent) FXMLLoader.load(App.class.getResource("skinFolder/fxml/"+fxml), null, new JavaFXBuilderFactory()); Scene scene = stage.getScene(); if (scene == null) { scene = new Scene(page, 700, 450); scene.getStylesheets().add(App.class.getResource("skinFolder/css/defaultSkin.css").toExternalForm()); stage

JavaFX auto-scroll auto-update text

帅比萌擦擦* 提交于 2019-12-20 01:35:12
问题 Newbie question about JavaFX that I haven't been able to answer, despite knowing it must be pretty simple to do and not finding any resources on it anywhere I've looked (tutorials, many of the Oracle online docs, articles, the well-known JavaFX bloggers, etc.) I'm developing a command line (script) running application and I have successfully gotten output (via ProcessBuilder) from the script that I can display in an ongoing manner, as things happen on the command line. That is, I can do

How to add an icon to the Tab control in FXML?

心不动则不痛 提交于 2019-12-19 10:10:06
问题 I'm using javafx 2.0. I want to add an icon to the Tab in fxml: example: <TabPane> <tabs> <Tab text="abc" > </Tab> </tabs> </TabPane> 回答1: I found a solution: <Tab> <graphic> <ImageView> <image> <Image url="@image.png"/> </image> </ImageView> </graphic> <content> ... </content> </Tab> 来源: https://stackoverflow.com/questions/9648485/how-to-add-an-icon-to-the-tab-control-in-fxml

What's the correct to make FXML members in Java 9 or 10?

旧时模样 提交于 2019-12-19 07:22:14
问题 After upgrading to Java 10 (from 8), I'm getting these errors: InaccessibleObjectException: Unable to make field private javafx.scene.control.Button tech.flexpoint.dashman.controllers.configurator.RegistrationController.registerButton accessible: module tech.flexpoint.dashman does not "opens tech.flexpoint.dashman.controllers.configurator" to module javafx.fxml Does it mean I should make them public? Does that make the @FXML annotation essentially useless in Java 9 and 10? 回答1: Since you're

What's the correct to make FXML members in Java 9 or 10?

为君一笑 提交于 2019-12-19 07:21:44
问题 After upgrading to Java 10 (from 8), I'm getting these errors: InaccessibleObjectException: Unable to make field private javafx.scene.control.Button tech.flexpoint.dashman.controllers.configurator.RegistrationController.registerButton accessible: module tech.flexpoint.dashman does not "opens tech.flexpoint.dashman.controllers.configurator" to module javafx.fxml Does it mean I should make them public? Does that make the @FXML annotation essentially useless in Java 9 and 10? 回答1: Since you're

JavaFX FXML communication between Application and Controller classes

浪子不回头ぞ 提交于 2019-12-18 18:26:34
问题 I am trying to get and destroy an external process I've created via ProcessBuilder in my FXML application close, but it's not working. This is based on the helpful advice Sergey Grinev gave me here. I have tried running with/without the "// myController.setApp(this);" and with "// super.stop();" at top of subclass and at bottom (see commented out/in for that line in MyApp), but no combination works. This probably isn't related to FXML or JavaFX, though I imagine this is a common pattern for

JavaFX : Adding a new node to Scene in java code when Scene is initially loaded from FXML

杀马特。学长 韩版系。学妹 提交于 2019-12-18 16:19:07
问题 How can I add a new node to the Scene in java code when Scene is initially loaded from FXML ? I have loaded from FXML as shown below Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); Scene scene = new Scene(root, 1000, 600, Color.DODGERBLUE); Now say for example how do I add button to the scene in Java code? 回答1: I do not know the reason behind your question. If what you want is to insert some nodes dynamically during the application or scene initialization, I suggest you