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
5
votes
1 answer

Why member is not injected in JavaFX controller?

I have the following FXML:
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
5
votes
1 answer

JavaFX: Use custom Node as collapse / expand branch switch for TreeView

Is it possible to replace the expand and collapse arrow of a TreeView with a custom Node / shape (instead of an image)?
Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
5
votes
3 answers

Field validation in JavaFX

I created one registration form using fxml. Now I want to implement the field validation functionality. I am trying to implement the validation for TextField but still I am not getting it.
naresh
  • 10,332
  • 25
  • 81
  • 124
5
votes
3 answers

Restart an Application in JavaFx

I want to close and then restart a already running application (automatically) that I am making, by clicking a button or something like that, I want to do that for the purpose of re-launching the application in an other language, I'm new to JavaFx…
AymenDaoudi
  • 7,811
  • 9
  • 52
  • 84
5
votes
2 answers

Fxml file not updating in Eclipse

I'm experiencing a weird behaving in Eclipse when working with JavaFx, when I modify a FXML document in SceneBuilder, I save the changes, but when I run the project, my changes don't appear, it s after I refresh the concerned Fxml document that the…
AymenDaoudi
  • 7,811
  • 9
  • 52
  • 84
5
votes
1 answer

Best way to create a flexible 3 box layout in JavaFX/FXML

I want to create a flexible 3-box layout in JavaFX/FXML. A picture describes it the best, so just like in the following: As you can see, the main part should consist of three resizable boxes. All of this boxes should have a preferred size. So the…
Appleshell
  • 7,088
  • 6
  • 47
  • 96
5
votes
3 answers

Setting TableView generic type from FXML?

The TableView class of JavaFX 2.2 has a generic type S, I am wondering how one can set this from FXML?
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
5
votes
1 answer

Load FXML files with custom components in JavaFX Scene Builder: Attributes are reset and children removed

I wrote an FXML-File where I use a custom component, extending Group. When loading this custom component, it should be adding some childs (here: MyOverlayIcon) to its children-list and set some attributes by code (here: layoutX and…
Daniel
  • 190
  • 3
  • 12
5
votes
2 answers

JavaFX - Wrapping FXML to Java Class Controller

I have a FXML file that has a TreeView control:
Leonardo
  • 1,263
  • 7
  • 20
  • 51
5
votes
0 answers

Use of fx:constant in attributes?

I am wondering, is it somehow possible to use in an attribute instead of a separate tag? Currently this works for me: while I would…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
5
votes
1 answer

Netbeans & JavaFX - Clean and build on each run?

I recently started working with JavaFX at the Netbeans IDE. I come along with the Hello World examples as it is not that complicated, but there is one big thing that is totally annoying me: As within my FXML project, I have to Clean & Build the…
Martin Bories
  • 1,067
  • 17
  • 37
5
votes
1 answer

JavaFX 2.2 FXML Validated TextField

I improved my previous implementation of TextField validation, this time making a true Custom Control with real-time validation using binding. It is usable with FXML without the need of more Java code. import…
matticala
  • 160
  • 3
  • 13
5
votes
1 answer

JavaFX 2 - Write Parent Object to FXML File

I know that I can load an FXML file into a Parent object with the following: parent = FXMLLoader.load(getClass().getResource(fxmlFile.getAbsolutePath())); Now I want to do the exact opposite and save a Parent object as the root of an FXML…
CBK
  • 141
  • 1
  • 6
5
votes
1 answer

Is there a way to modularize a JavaFX application?

I've started toying with JavaFX 2 and I really like the ease with which one can create a UI with FXML. However, once you get past the basic examples and you need a UI with many windows, it seems illogical to have the definition for the whole…
corbenik
  • 126
  • 2
  • 8
5
votes
2 answers

JavaFX 2.0 + FXML - strange lookup behaviour

I want to find a VBox node in a scene loaded with FXMLoader thanks to Node#lookup() but I get the following exception : java.lang.ClassCastException: com.sun.javafx.scene.control.skin.SplitPaneSkin$Content cannot be cast to…
Philippe Jean
  • 317
  • 5
  • 12