Questions tagged [fxml]
a scriptable XML-based language that provides the structure for building a JavaFX user interface separate from the application logic of your code.
3,611
questions
228
votes
10
answers
232k
views
Passing Parameters JavaFX FXML
How can I pass parameters to a secondary window in javafx? Is there a way to communicate with the corresponding controller?
For example:
The user chooses a customer from a TableView and a new window ...
105
votes
5
answers
88k
views
JavaFX - setVisible hides the element but doesn't rearrange adjacent nodes
In JavaFX, if I have a scene with 2 VBox elements and each VBox has multiple Label in it.
If I set the top VBox to invisible, why does the bottom VBox not move up the scene where the top VBox was ?
...
95
votes
3
answers
69k
views
Where has the JavaFX scene builder gone?
I am trying to find the elusive JavaFX scene builder so I can use it in Intellij. I am on Windows OS.
Oracle have stated that the JavaFX scene builder is included in a new download, but no matter how ...
80
votes
4
answers
112k
views
Accessing FXML controller class
I would like to communicate with a FXML controller class at any time, to update information on the screen from the main application or other stages.
Is this possible? I havent found any way to do ...
70
votes
26
answers
168k
views
JavaFX 2.1 TableView refresh items
I have this common issue, as it appears to be. My table view wont refresh my items after I reset them. I have checked the data and it's the new one.
I tried multiple solution from internet but no ...
68
votes
3
answers
38k
views
Label and Text differences in JavaFX
What is the difference between javafx.scene.text.Text and javafx.scene.control.Label?
The documentation says:
Label is a non-editable text control.
The Text class defines a node that displays a ...
67
votes
9
answers
212k
views
close fxml window by code, javafx
I need to close the current fxml window by code in the controller
I know stage.close() or stage.hide() do this in fx
how to implement this in fxml? I tried
private void on_btnClose_clicked(...
62
votes
2
answers
27k
views
Remove the default 'no content in table' text for empty javafx table
I would like to remove or change the default text shown by an empty javafx table from No content in table to something more meaningful for the user.
For example in a table showing students, when ...
50
votes
3
answers
99k
views
How to reference javafx fxml files in resource folder?
I am creating a javafx GUI application and my project is a maven configured project. I want to be able to reference my fxml files like this in my controllers:
FXMLLoader.load(getClass().getResource(&...
49
votes
6
answers
119k
views
JavaFX Panel inside Panel auto resizing
I have a JavaFX application which has only one FXML file. In this file I have one AnchorPane which has a StackPane inside it. Here is the screenshot:
When I start this application, I want to resize ...
47
votes
9
answers
119k
views
JavaFX FXML API version warning
I have recently started noticing the following warning when starting my JavaFX application:
WARNING: Loading FXML document with JavaFX API of version 8.0.65 by JavaFX runtime of version 8.0.60
...
44
votes
15
answers
47k
views
IntelliJ IDEA - getClass().getResource("...") return null
I'm using IntelliJ IDEA 13.1.5, I used to work with Eclipse. I'm working on JavaFX application, I try to load FXML file within my MainApp class using getClass().getResource().
I read the documentation ...
44
votes
4
answers
54k
views
How to create custom components in JavaFX 2.0 using FXML?
I can't seem to find any material on the subject. To give a more concrete example, let's say I want to create a simple component that combines a checkbox and a label. Then, populate a ListView with ...
43
votes
9
answers
108k
views
Loading new fxml in the same scene
I have 2 fxml files:
Layout (header, menubars and content)
Anchorpane (it's supposed to be placed inside the content from the other fxml file)
I would like to know how can I load the second file ...
40
votes
5
answers
97k
views
How to make window fullscreen/maximized in Scene Builder?
I am making a view in SceneBuilder for my JavaFX application. I want my view to be maximized. How can I achieve this in SceneBuilder or the .fxml file?
37
votes
3
answers
68k
views
Customize ListView in JavaFX with FXML
I want to make a customize list view in javafx. Here I need to bind multiple component in list cell as follow, like
one label, one textfield, one button under one HBox and
two button, one hyperlink, ...
36
votes
2
answers
20k
views
FXML full reference?
I'm trying to learn JavaFX 2.0 + FXML, and i found it kind of uncomfortable to make fxml file, without knowing what i can put in it and what i can't. I mean which tags are possible in FXML, which ...
35
votes
8
answers
27k
views
How to control the JavaFX Tooltip's delay?
I was playing around with JavaFX's Tooltip. I realized that for me personally the delay between hovering over something and the tooltip actually appearing is too long. A look in the API reveals:
...
35
votes
8
answers
124k
views
How to switch scenes in JavaFX
I have looked on many pages to try and find out how to switch scenes but I have been unsuccessful.
I have a calculator and my goal is to select a menu option to change Calculators(ie: basic and ...
34
votes
7
answers
39k
views
Why would scenebuilder 2.0 fail to open my fxml file?
I have an fxml file that I created using SceneBuilder 2.0. This file is used in my JavaFx project that I am developing using Netbeans 8. Today, SceneBuilder stopped working with my file. When I tried ...
33
votes
2
answers
77k
views
How do I add margin to a JavaFX element using CSS?
I have the following fragment of FXML:
<VBox fx:id="paneLeft">
<TextField promptText="Password"/>
<Button fx:id="btnLogin" text="Login" maxWidth="10000"/>
<Hyperlink ...
31
votes
5
answers
90k
views
How to get selected radio button from ToggleGroup
I an working on JavaFX 8 and SceneBuilder. I created some radio buttons in the FXML File and specified a toggleGroup name to a radio button list in that. So, now I want to get the toggleGroup's ...
31
votes
3
answers
73k
views
Styling a JavaFX 2 button using FXML only - How to add an image to a button?
I want to change the styling of a button, most of the threads here and the articles on the internet show how to do it using Java code, which I don't see it as a real good solution, is there any way ...
31
votes
1
answer
30k
views
JavaFX Project Structure
JavaFX's MVC Model by using FXML sounds awesome and all but I'm having trouble find out how to organize my project packages.
Every single tutorial i find about JavaFX is way too simple and ...
31
votes
4
answers
64k
views
How to create multiple javafx controllers with different fxml files?
I've been looking at some blogs and other stackoverflow questions, and I'm not seeing a direct answer to my question. I am creating a javafx gui client and I want to have my menubar be one controller ...
30
votes
6
answers
96k
views
JavaFX: FXML: How to make the child to extend its size to fit the parent pane?
I have managed to load a child fxml(sub UI) under a parent fxml (mainMenu UI).
I have created an AnchorPane with id "mainContent". This pane is bound to 4 sides and changes in accords to the stage.
...
29
votes
2
answers
42k
views
Multiple FXML with Controllers, share object
Goodevening everyone,
I have found a bunch of posts already on this topic but I still can not manage to pass an object from Controller1 to Controller2. Is there somewhere a full tutorial or some ...
29
votes
2
answers
39k
views
JavaFX Nested Controllers (FXML <include>)
In this tutorial, there is an example of how to include custom components and use their controllers from the controller of the container.
main_window_content.fxml
<VBox fx:controller="com.foo....
28
votes
2
answers
44k
views
How to embed .ttf fonts in JavaFx 2.2?
Firstly, I am quite a new guy in coding. I need to embed a font in my java FXML-based app and don't know how to do it. I have pasted the font, fontName.ttf in a "resources" folder in the ...
28
votes
3
answers
29k
views
How to initialize JavaFX controllers with the same model object?
Scenario
I am creating a GUI where multiple views reference the same model object.
What I am Accustom to
In Swing, if i want all the views to reference the same model i would pass the model into ...
26
votes
2
answers
79k
views
Javafx open another fxml in the another window with button
Is it possible in javafx to open new stages (windows) from another fxml with a button?
Thanks for the answers.
26
votes
5
answers
94k
views
How to handle ListView item clicked action?
I have my JavaFX 2.0 application, where i need to make some action, after user clicked an item in ListView element. To construct user GUI i'm using FXML, in which i have something like this:
&...
26
votes
1
answer
30k
views
How to get parent Window in FXML Controller?
For example, I want open a DirectoryChooser when clicking on the button:
<VBox fx:controller="com.foo.MyController"
xmlns:fx="http://javafx.com/fxml">
<children>
<...
25
votes
2
answers
47k
views
FXMLLoader getController returns NULL?
I have the main application class that does the following just fine:
@Override
public void start(Stage primaryStage) {
try {
FXMLLoader loader = new FXMLLoader(getClass()....
23
votes
1
answer
21k
views
What is the "mnemonicParsing" attribute in Java FX
I have been working with SceneBuilder and I observe that it applies the attribute of mnemonicParsing and equates it to false for every Node that I make.
What exactly is it? What difference does it ...
22
votes
3
answers
26k
views
Is @FXML needed for every declaration?
Is @FXML needed for every declaration or just for the first?
In other words, should I use
@FXML
public Label timerLabel = new Label();
@FXML
public TextField mainTextField, projectTextField ;
@FXML
...
22
votes
6
answers
33k
views
Default JavaFX-CSS
Is there any way to see the applied CSS-Rules for JavaFX-Elements? Or there is a published reference with the default CSS-Rules available?
I would like, for example , to know the color of Toolbar's ...
22
votes
1
answer
54k
views
Java FX fxml on Action
I want to add a method to a button which is defined in my Controller class
in the console is only an error which tells me that it couldn't find the method
here is the code
sample.fxml
<?xml ...
21
votes
4
answers
36k
views
Bootstrap with JavaFX
I am creating a GUI in a java fxml project using netbeans. I wanted to use bootstrap to style the gui but I have noticed that everything in javafx is prefixed with fx-. Is there still a way to get ...
20
votes
1
answer
75k
views
JavaFX How to set max/min window size?
Does setMinSize() work on containers such as GridPane, for example? I have found that in my program GridPane ignores min. size properties while resized manually.
Here is the FXML code:
<GridPane ...
20
votes
2
answers
31k
views
How to change sub fxml gui parts at runtime with Button Click
I'm tryin to build a skeleton for a big complex gui, so the idea is to make everything with mvc like style in javafx 2.1, so every component has a fxml file and if needed css,controller and model. I'm ...
20
votes
2
answers
22k
views
JavaFX 8 - Tabpanes and tabs with separate FXML and controllers for each tab
I hope to get some answers regarding having fx:include statements for each tab in a tabpane. I have managed with ease to get content to show up BUT referencing methods of the associated controller ...
19
votes
3
answers
39k
views
ComboBox FXML default value
How can I set a default value in a ComboBox using FXML?
<ComboBox fx:id="cbo_Bacteriologie_Aesculine" prefHeight="21.0" prefWidth="105.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
<...
19
votes
7
answers
138k
views
How can I show an image using the ImageView component in javafx and fxml?
I suppose it's a very simple thing but I just can't get behind it.
All I want is to show an image over an ImageView linked to fxml.
Here is my code:
package application;
import java.io.File;
import ...
19
votes
8
answers
44k
views
Can I automatically generate controller classes from FXML?
As I understand it, when using FXML to describe a Java FX scene, the controller class is written manually and it's member variables and methods can then be referenced from the .fxml file. When loading ...
19
votes
2
answers
93k
views
How to position a button (or any GUI element) in a JavaFX scene?
I am trying to put a JavaFX button in a specific place (specific coordinates) on a UI, but nothing is working. I'm guessing that there is a method that is used for this, but I can't find it.
19
votes
1
answer
12k
views
Set multiple styleClass values
How does one set two classes on a node in a JavaFX FXML file?
<VBox styleClass="notice high">
This adds one value "notice high" instead of two values "notice" and "high". How can I add two ...
18
votes
7
answers
26k
views
RequestFocus in TextField doesn't work
I use JavaFX 2.1 and I created GUI using FXML, in the controller of this GUI I added myTextField.requestFocus();.
But I always get the focus in the other control.
18
votes
3
answers
33k
views
How to reference primaryStage [duplicate]
I use .fxml-Files for the view-layer of my application. Each fxml has a controller attached to it
<AnchorPane fx:controller="movielistjavafx.view.MainWindowController">
Let's assume I have a ...
18
votes
3
answers
13k
views
Getting started on Scala + JavaFX desktop application development
Is there some guide or walkthrough to building a Scala + JavaFX desktop application?
I'm having hard time finding a good source and I am using IntelliJ IDEA as the IDE.
Even the most simplistic ...