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

How can i Change the DOt in a JavaFx RadioButton?

Hello Stackeroverflowers, i'd like to ask how can i change a RadioButton Dot? I need to define 3 RadioButtons with 3 different Colors to show a state. Do i have to work with Css? Would be perfect if anyone could tell me how can i realize that ? A…
Artur Rem
  • 209
  • 1
  • 4
  • 18
7
votes
2 answers

JavaFX ImageView via FXML does not work

I have a problem with loading Images with ImageView on FXML. My controller class: public class BoxViewController { @FXML private Label label_boxID; @FXML private ImageView boximage; public void…
mathew11
  • 3,382
  • 3
  • 25
  • 32
7
votes
3 answers

Get all text fields values and id in javafx

I have an anchor pane with many text fields and other controls. I want to take values of all controls and their names and id. For example: how can I clear all textfield values?
Anshul Parashar
  • 3,096
  • 4
  • 30
  • 56
7
votes
2 answers

How does FXMLLoader load the FXML's controller?

What happens when I call FXMLLoader#load() in JavaFX? Suppose the FXML controller extends a class that has a constructor. Will there be assurance that the constructor will be called? And if not, how will a new instance of the object be created? For…
damat-perdigannat
  • 5,780
  • 1
  • 17
  • 33
7
votes
2 answers

JavaFX 1 FXML File with Multiple Different Controllers?

There are two different stages in my application that are help screens that use the same FXML file. Rather than create 2 FXML files, I would like to use just one and have two controllers that call the same fxml. The only problem is that the…
Matt
  • 5,408
  • 14
  • 52
  • 79
7
votes
3 answers

Java combobox how to add icon?

Im new to FXML and i'm building an application. Now i'm running into a problem that i cant fix. I defined a combobox in the FXML and created the necesarry assocation in the controller class. But i want to add images to this combobox. Still after…
Bart Pasmans
  • 135
  • 1
  • 3
  • 7
7
votes
1 answer

Javafx 2.0 : How to change the size of the radio-buttons circle with CSS?

I try to change the radio-buttons size in my app build with FXML and CSS. I use the sceneBuilder. Thanks for your help ! Here is my actual CSS code for the radio-buttons : .radio-button .radio{ -fx-border-width : 1px ; -fx-border-color :…
A.Fauchere
  • 73
  • 1
  • 1
  • 3
7
votes
2 answers

changing text color of a Menu control in JavaFX with FXML/CSS

I want to change the text color of the Menu control in JavaFX. Currently, the background color of the whole Menu Bar is set to white and the default text color for displaying Menu-s is also white, so I cannot see the actual control, therefore I want…
XXL
  • 1,224
  • 4
  • 12
  • 25
6
votes
2 answers

Prefill ListView in an application with FXML

I have JavaFX application using FXML to build its GUI. When this application is launched, I need to have ListView, which has some values loaded, for example, from database. So, how can I do this? I know how to make application, which loads items to…
Victoria Agafonova
  • 2,048
  • 10
  • 33
  • 50
6
votes
3 answers

Scene Builder Editor displaying weird characters

I just installed Scene Builder and my editor looks like this. Can't read anything. I assume somehow I am missing the font the editor tries to use?
Nscpt
  • 81
  • 4
6
votes
1 answer

JavaFX and Scene Builder clip scene edges despite specifying USE_COMPUTED_SIZE

I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a…
Bobulous
  • 12,967
  • 4
  • 37
  • 68
6
votes
1 answer

JavaFX Dropshadow CSS: What do the parameters mean? How to implement width and height in CSS?

I've been searching for this all over the internet, but for most of the questions I viewed that answered in CSS, people just gave code without explaining them. -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.3), 10, 0.5, 0.0, 0.0); For this line of…
Hykilpikonna
  • 1,749
  • 2
  • 15
  • 32
6
votes
1 answer

How to dynamically change font size in UI to always be the same width in JavaFX?

What I am trying to do is create a label in fxml, using Scenebuilder, which updates its font size to always ensure that the content of the label is the same size. Some background info is that I am using an AnchorPane, which is maximized and…
Riley Fitzpatrick
  • 869
  • 2
  • 16
  • 38
6
votes
1 answer

Is tag useful in fxml? Should it be removed?

IntelliJ checkstyle indicates that this tag should be removed, as it is not required, as in instead of ... ... you can simply have
Florin Mircea
  • 966
  • 12
  • 24
6
votes
1 answer

FXML: An elegant way to bind a child width/height to the parent's width/height

I'm using FXML with JavaFX to develop graphical interfaces. I discovered this method for binding the width/height of a child node to the width/height of it's parent node:
J-bob
  • 8,380
  • 11
  • 52
  • 85