fxml

JavaFX FXML Application won't run

喜你入骨 提交于 2020-01-06 05:51:46
问题 I'm trying to follow the tutorial here. But, my IDE, Eclipse, doesn't seem to want to work with it. I've tried copying and pasting the code examples into my IDE, but the same error pops up. Unfortunately, no window is displayed. Please help me figure out what's wrong with this code. The error: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke

JavaFx element not binding to controller variable on fx:id [duplicate]

不羁的心 提交于 2020-01-06 03:37:26
问题 This question already has answers here : JavaFX FXML controller - constructor vs initialize method (3 answers) Closed 3 years ago . This is likely pilot error, but the FXML attribute is not binding to the controller class on fx:id. I've whittled it down to a trivial example, but still "no joy". What am I overlooking? FXML file... <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.BorderPane?> <BorderPane fx:id="mainFrame" maxHeight="

JavaFX+MVC. How to hide/show multiple windows?

て烟熏妆下的殇ゞ 提交于 2020-01-06 02:00:07
问题 How to make that when i click on "Open second window" the main window be hide. And when i close second window, the main window be showed? I read this post, but i don't know how to implement it for my task. Thanks! I have next code: Main.java public class Main extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("First Stage"); try { primaryStage.setResizable(false); Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml")); Scene scene =

How can I set a graphic for a TreeItem in FXML?

醉酒当歌 提交于 2020-01-05 19:01:43
问题 I'm trying to configure the root node of my TreeView in FXML: <TreeView fx:id="treeView" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"> <TreeItem expanded="false" value="Root" fx:id="rootItem" graphic="/icons/icon_folder.png" /> </TreeView> There is a property called graphic which takes a Node , and not a String as I have supplied above. How do I give it a node in FXML that would represent the image stored in my resource at icons/icon_folder.png? In Java, I can do the following:

How can I set a graphic for a TreeItem in FXML?

断了今生、忘了曾经 提交于 2020-01-05 19:00:18
问题 I'm trying to configure the root node of my TreeView in FXML: <TreeView fx:id="treeView" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"> <TreeItem expanded="false" value="Root" fx:id="rootItem" graphic="/icons/icon_folder.png" /> </TreeView> There is a property called graphic which takes a Node , and not a String as I have supplied above. How do I give it a node in FXML that would represent the image stored in my resource at icons/icon_folder.png? In Java, I can do the following:

How to get the controller of an included FXML?

不羁岁月 提交于 2020-01-05 07:11:30
问题 I have a simple two tab application build around JavaFXML and scenebuilder. The tabs do nothing at present because I cannot get past a nullpointer exception when trying to load them. The java and fxml files are arranged in a Netbeans project like this: Main Application: The application main class MainApp.java sets the scene and is declared as follows: package tabpane; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application

Graphic automatically fill button

我的梦境 提交于 2020-01-05 06:57:10
问题 I'm using JavaFX, fxml, and css to display buttons with an image. When I change the size of the window, the image of the button nicely moves with the center of the button. I also want the image to scale up to, say, 80% of the button, but I can't figure out how to do that. A Java solution would be fine as well, if it can't be done in just fxml or css. The code is below, but I also made a repo with a MWE on GitHub. fxml <?import javafx.geometry.Insets?> <?import javafx.scene.layout.GridPane?> <

Add custom component to FXML scene builder in intelliJ

瘦欲@ 提交于 2020-01-05 06:54:05
问题 I want to add a custom component / custom components to the javafx scene builder in intelliJ. I'm currently using java 8.1. I heard that adding components to the scene builder is possible with java 10 because it has java 2.0. I have java 10 installed, but I don't know how to switch to that version of java. So if you know how to solve this problem, I'd love to hear it. Thanks in advance, Lenardjee Edit: I see why this problem is simular to other posts, for the direct problem is directly adding

Add custom component to FXML scene builder in intelliJ

百般思念 提交于 2020-01-05 06:53:21
问题 I want to add a custom component / custom components to the javafx scene builder in intelliJ. I'm currently using java 8.1. I heard that adding components to the scene builder is possible with java 10 because it has java 2.0. I have java 10 installed, but I don't know how to switch to that version of java. So if you know how to solve this problem, I'd love to hear it. Thanks in advance, Lenardjee Edit: I see why this problem is simular to other posts, for the direct problem is directly adding

JavaFX pausing during for loop WITHOUT using Thread.Sleep()

对着背影说爱祢 提交于 2020-01-05 04:08:11
问题 I'm coding this in JavaFX using a FXMLController and the scene builder. I'm currently creating an Instagram "liker" mostly just for practice as I'm a Computer Science major, and I just like coding. My issue is, I have a for loop that "likes" 20 photos for each hashtag, I obviously need a delay or I'd get banned rather quickly. The user can choose the delay, then I randomize this delay so it's not too robotic. The only way I've been able to use this delay is through the thread.sleep method,