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

SceneBuilder 2: Do controller classes need to necessarily be in the same folder as the view FXML files?

I'm loving JavaFX and SceneBuilder, but I just can't figure out how to make SceneBuilder link my FXML views with their Java controllers when they are not in the same folder. I'd just like to have this folder structure: package |-- model …
zapatilla
  • 1,711
  • 3
  • 22
  • 38
5
votes
1 answer

Is it possible to add a component loaded from an FXML file more than once without rereading it?

So I'm getting started with javafx and I was wondering the following: Lets say I have an application with some container inside. For example: VBox vBox = new VBox(); And I also have an FXML file which contains some other component I want to add to…
Quijx
  • 366
  • 1
  • 10
5
votes
1 answer

JavaFX How to change the GridPane row height programmatically

I have a problem that has been driving me nuts for a couple of days. I have a GridPane and I want to hide the first row when I click on a button. This is the FXML file
stefOCDP
  • 803
  • 2
  • 12
  • 20
5
votes
1 answer

JavaFX8 - FXML How to call method with parameters in onAction-tag?

How is it possible to call a method with parameters out of FXML? In Java I use this code: textfield.setOnAction(event -> { endEdit(false); }); In FXML I know I can call a method like this: So how can I call the…
S.Pro
  • 633
  • 2
  • 12
  • 23
5
votes
1 answer

TextFlow vs TextArea, layout problems; why is TextFlow messing it where TextArea does not?

Here is the original fxml file (imports omitted for brevity):
fge
  • 119,121
  • 33
  • 254
  • 329
5
votes
2 answers

How to make Textarea Vertical Scroll bar always active?

I tried many times to make the vertical Scroll Bar of Textrea to be always active instead of being visible only when focus on the Textarea but I couldn't do that ! .. any help please
Jason4Ever
  • 1,439
  • 4
  • 23
  • 43
5
votes
2 answers

Set placeholder of JavaFX TableView in FXML

I know the following problem is a bit of a luxury problem: I would like to keep the initialize of my FXML Controller as clean as possible, and therefore I would like to set the placeholder of my TableView in the FXML file (as I think it is the best…
bashoogzaad
  • 4,611
  • 8
  • 40
  • 65
5
votes
1 answer

Is it possible to import a JAR containing a custom JavaFX control into Scene Builder?

I was working on a stage when I noticed I practically had the exact same thing three times. Rather than that (since I hate that), I decided to take what I had those 3 times and turn it into a custom component. Now I know I can add it in code but I…
Will
  • 3,413
  • 7
  • 50
  • 107
5
votes
5 answers

JavaFX Image not showing in stage

I've tried several times and several ways but I can't make my image show on stage as I want. I think it might has to do with the path where java looks for resources, but i'm not sure, since I'm just starting using visual libraries (JavaFX in this…
Throoze
  • 3,988
  • 8
  • 45
  • 67
5
votes
2 answers

JavaFX UI Controls Architecture (Control+Skin) with FXML

In JavaFX8 there is a UI Controls Architecture that is used for make custom controls. Basically is based in: Control. Skin. CSS. Also, there is a basic structure of an FXML project that is used to make GUI too. Basically: Control. FXML…
Marlord
  • 1,144
  • 2
  • 13
  • 24
5
votes
1 answer

Drawing a Region with CSS -fx-shape. How it is possible?

I'm looking a way to draw shapes in a Region (JavaFX8) I've seen some examples that set the region style like this: -fx-shape : "M 3.0313 0 L 0 74 L 7.9688 74 L 4.9375 0 L 3.0313 0 Z"; Can anyone give an explanation of the meaning of…
Marlord
  • 1,144
  • 2
  • 13
  • 24
5
votes
2 answers

How to define a Column for buttons in FXML (JavaFX)

I know that it is possible to create a column in TableView filled with buttons thanks to jewelsea. But I want to know if it's possible to define it directly in the FXML. As an example, with other types one do: Class Person: private final…
Mansueli
  • 6,223
  • 8
  • 33
  • 57
5
votes
1 answer

how to split JavaFX GUI into fxml files with good performance?

I am working on an enterprise-scale project on which JavaFX 8 was choosen as the frontend technology. Target platform is a windows-based tablet, so performance is even more likely to be an issue on this. The application is made up of dozens of…
Simon Baslé
  • 27,105
  • 5
  • 69
  • 70
5
votes
2 answers

Populate Choicebox defined in FXML

I'm learning javaFX and my problem is that I have simple window with some choicebox and button. This window is defined via FXML which is also associated with controller class. I would like to know, how to populate this choicebox with data in the…
user2151486
  • 778
  • 2
  • 13
  • 25
5
votes
2 answers

What is wrong with my syntax calling a stylesheet (css) from an FXML file?

I am working in NetBeans 8, with Java 8 / JavaFX and FXML. In the first controller (an AnchorPane) in my FXML document, I have this, that works: stylesheets="file:///C:/Users/me/Documents/NetBeansProjects/MyApp/src/myApp/myStyle.css" However, when…
adeena
  • 4,027
  • 15
  • 40
  • 52