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.

FXML was introduced with the release of JavaFX 2.0 in 2011 by Oracle. It's rich XML-based language to declare JavaFX UI in structured format.

Using FXML allows to separate logic from presentation which is very welcome in modern MVC world.

In addition to straightforward UI declaration FXML allows:

  • using Controller for seamless mapping of the XML entities to the JavaFX objects.
  • referring property files (e.g. for i18n support)
  • introducing variables
  • setup complex object by referring static method calls
  • work with collections
  • even using JavaScript or other scripting languages

A good start to learn more about the format would be the Oracle article JavaFX: Mastering FXML.

3561 questions
225
votes
10 answers

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 is opened, showing the customer's info. Stage…
Alvaro
  • 11,797
  • 9
  • 40
  • 57
102
votes
5 answers

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 ? The VBox is invisible but I would expect the…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
95
votes
3 answers

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 I search I cannot find it (see…
tentimes
  • 1,462
  • 1
  • 11
  • 16
80
votes
4 answers

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 it. Static functions could be a way, but they don't…
betaman
  • 1,865
  • 5
  • 25
  • 30
69
votes
26 answers

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 success. Can't reset all the columns because it…
user1236048
  • 5,542
  • 7
  • 50
  • 87
67
votes
3 answers

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 text. But the Label class has a method "setText"…
Marlord
  • 1,144
  • 2
  • 13
  • 24
67
votes
9 answers

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(ActionEvent actionEvent) { Parent root =…
alfredo138923
  • 1,509
  • 1
  • 15
  • 15
61
votes
2 answers

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 there are no students to show I want it to say "No…
50
votes
3 answers

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("main.fxml")); Where my main.fxml file is located…
j will
  • 3,747
  • 11
  • 41
  • 64
49
votes
6 answers

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 StackPane automatically with the AnchorPane. Thus;…
Korki Korkig
  • 2,736
  • 9
  • 34
  • 51
44
votes
4 answers

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 instances of this custom component. UPDATE: see my…
Andrey
  • 8,882
  • 10
  • 58
  • 82
44
votes
15 answers

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 and I try several idea, at the end I have…
BilalDja
  • 1,072
  • 1
  • 9
  • 17
43
votes
9 answers

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 inside the content space from the "Master" scene.…
Andre
  • 617
  • 2
  • 6
  • 10
42
votes
9 answers

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 The FXML in question was created by Gluon Scene…
Itai
  • 6,641
  • 6
  • 27
  • 51
40
votes
5 answers

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?
Navi89CZ
  • 421
  • 1
  • 4
  • 6
1
2 3
99 100