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

Java vs JavaFX Script vs FXML. Which is better way of programming in JavaFX?

I am new to JavaFX and I come across 2-3 ways of designing UI in JavaFX. Simple Java file which is same methodology we used in Swing JavaFX Script which I don't know FXML which is xml based file for UI designing Which of these is better? and why?
tarkikshah
  • 534
  • 6
  • 16
6
votes
4 answers

Multiple controller for one FXML file

I have one fxml file controlled by one controller. I want to separate the controller into multiple parts as if placed in one controller makes a long code. Unfortunately, fx:controller can only be placed in the root. Are there any suggestions for me…
hindarwan
  • 159
  • 2
  • 2
  • 7
6
votes
1 answer

Have multiple FXML files (created in SceneBuilder), but only one controller. Does each scene load it's own copy of the controller?

I have multiple FXML files I have created in SceneBuilder and one controller file. When I edit a value (say for instance, an integer value) in one scene, and then switch scenes, that value does not seem to have been changed in the new scene. When…
Aaron
  • 63
  • 1
  • 2
  • 6
6
votes
2 answers

Associating FXML and Controller in Guice's Module configuration

In my Guice Module I want to associate FXML files and their controllers, currently it looks like this: public class GuiceModule extends AbstractModule { @Override protected void configure() { // associate controllers and fxml…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
6
votes
1 answer

How to make a JavaFX-Widget

is it possible to stick a stage to the desktop? I want to behave my application as widget, so when it starts it should be displayed right above the desktop and not in front of the current application which might be opened. The other condition for a…
Gundon
  • 2,081
  • 6
  • 28
  • 46
6
votes
2 answers

How to Convert FXML to JAVA

I created a .fxml file using javafx scene builder in NetBeans. How can I convert .fxml file in NetBeans to .java? Is that any program to convert it? I am not very good in fxml so I want to use .java file to code my javafx app.
Ken Wong
  • 109
  • 2
  • 2
  • 9
6
votes
1 answer

Adding JavaFX2 Controls dynamically

I'm quite new to java and javafx and have a problem which i could not solve. I need to dynamically add new custom controlls to a javafx scene. Further i need interaction between the main control and the added controls. I found already some useful…
solarisx
  • 157
  • 1
  • 11
5
votes
1 answer

Netbeans7.1 & JavaFX 2.0 - FXML code completion doesn't work

I started learning JavaFX 2.0 and installed Netbeans 7.1, java 7.02 SDK (wich contains JavaFX 2). Everything seems to work, the example projects compile and run fine. My problem is: Code completition doesn't work for FXML files. I press ctrl+space…
Adamsan
  • 662
  • 1
  • 15
  • 27
5
votes
1 answer

How do you create a ScrollBar using FXML in javafx2?

EDIT I was looking for a "ScrollPane" not a ScrollBar.
5
votes
7 answers

Cant create new FXML File in Eclipse

When Im trying create a new FXML File in Eclipse (File -> New -> Other -> JavaFX - new FXML Document -> Next) nothing happens. It doesnt create a File. Same Problem when I try to create FXGraph or JavaFX HTML Template whatever those are. After I…
flexmaster
  • 53
  • 1
  • 4
5
votes
1 answer

Using Unicode characters with JavaFX

I've been playing around with swing for some time and decided to check out FX now. So far I'm finding it a lot easier and more fun to work with as compared to swing but I've run into a small speed bump and after hours of looking around I just can't…
Talha
  • 55
  • 1
  • 7
5
votes
1 answer

How can I add items to a ComboBox (or other Control) using FXML?

Recently, I discovered that —and other controls—can have an element underneath them . How can I populate, or add items right to a control in the FXML markup? (One use case for this might be to make the FXML semi-functional as a…
Brad Turek
  • 2,472
  • 3
  • 30
  • 56
5
votes
1 answer

Can I store instance of an object in a javaFX node?

I have a JavaFX application, starting with main window as a TabPane object. In that TabPane I have a specific Tab, which contains a Button object, that can add new tabs to the main TabPane. But I need to entangle each Tab in the main TabPane with a…
Adam Bajger
  • 523
  • 7
  • 20
5
votes
2 answers

JavaFx: How to set the labelFor property of a Label in FXML?

I have a TextField and a Label with mnemonicParsing true. I want to set the labelFor property of the label with the id of the TextField. How do I do that in FXML?
Paul
  • 275
  • 1
  • 2
  • 13
5
votes
2 answers

JavaFX - Why there is a line under every Control element and how to remove it?

I noticed that every element which inherits from the Control class has an underscore at the bottom. You can see it in the picture: When I put a focus on any of items, the line disappears. Why does it happen and how can I get rid of…