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
1
vote
0 answers

Cannot identify the value of a Pane in a method

This is the function which called on clicking save button in save wizard FXML. @FXML public void Onsave() { // Handle Button event. System.out.println(myButton9.getId()); myButton9.setOnAction((event) - > { String text1 =…
1
vote
3 answers

Loading a FXML into borderpane center

Good evening guys, I am playing around with JavaFX. The aim is to load a prepared fxml into the center element of a borderpane on button click. Unfortunately, I am getting the following error: Caused by: javafx.fxml.LoadException:…
n3wton
  • 79
  • 2
  • 9
1
vote
1 answer

Javafx location is required (loading FXML file from another folder/package)

I have an issue using Java with FXML files. I searched for hours now and couldn't find anything that solves my problem, so my last hope is to ask the question for my specific case (I'm aware of question like this one and others but none really…
Chris777
  • 43
  • 1
  • 7
1
vote
1 answer

Java FXML TableColumn not supporting GregorianCalendar

The GregorianCalendar is not displayed correctly inside the cells of the tablecolumn. When i use Strings, ints and doubles it works fine. When i run the application the cells containing dates show…
Roy
  • 23
  • 1
  • 8
1
vote
1 answer

Trying to set text of a textField with no luck

I'm trying to read data from a database and set it as text in a textfield when I click a button. I can't for the life of me figure out why this code doesn't work. Any help is appreciated. Label works, and textfield doesn't. They're in the same…
stwinward
  • 15
  • 2
  • 4
1
vote
0 answers

set the opacity of dialog box outside in javafx application

I have to set the opacity only to the outside of the message box, but when I change the opacity outside and message box both change. Here is the Code: package com.home.fxmessage; import javafx.event.ActionEvent; import javafx.fxml.FXML; import…
Milinda Saranga
  • 205
  • 3
  • 13
1
vote
1 answer

How to map a form to a bean in Java FX

I have a form made with fxml, it has like 20 fields. (I.e. Person) and I have my controller with the 20 fields (one for every field) o want to know if there is a way to box all these fields in a unique bean like PersonBean. Actually I have to set…
dragonalvaro
  • 703
  • 1
  • 10
  • 28
1
vote
0 answers

JavaFX - Trouble with creating tabs

I want that when pressing the "accept" button created new tab. But throw exceptions. I try create command class (CreateTab class) but unfortunately all the same. Tabs public class Tabs implements Initializable { @FXML TabPane…
GingerComa
  • 149
  • 2
  • 12
1
vote
1 answer

Initializing in javafx controller

I am building application using javafx fxml project in netbeans. As part of it I am printing a node in the controller. For that I am changing the node layout, so that it can fit in half page. Now after printing, how do I go back to the original…
jay
  • 101
  • 1
  • 3
  • 13
1
vote
1 answer

Fxml Controller Inject Final Field

For a fxml controller class that would map to an fxml control, such as: public MyController { @FXML private Button button; } Is it possible to declare the button field as final? If it was done, the java compiler (javac) would flag an error…
pntran84
  • 463
  • 1
  • 3
  • 11
1
vote
1 answer

Property bindings in JavaFX TableView are not working

I followed many links and found a solution to display check box in table view. But I am unable to change the value of checkbox in table view. Link I followed: How to add CheckBox's to a TableView in JavaFX Model Class: public class TUser { …
Biswadip Dey
  • 509
  • 2
  • 7
  • 20
1
vote
1 answer

FXML Variables not binding

I am having an issue with my FXML injection. I have setup my program as far as I can tell but it seems that I am missing something. My code is below: Main: package application; import javafx.application.Application; import…
mpower
  • 13
  • 5
1
vote
3 answers

JavaFx keep window size after user resizes

I currently use the following code to switch between scenes. I want to switch between windows and KEEP the window size (so when the users change the windows size manually by resizing the window, it will stay at the chosen size even after scene…
Tim Joseph
  • 847
  • 2
  • 14
  • 28
1
vote
1 answer

how to change parent fxml content from action perform on child fxml component?

I created JavaFX application and want to distribute complete functionality among different FXML with hierarchy and MVC structure. At the start time RoolLayout.fxml is load which is parent FXML RootLayout.fxml
Nikunj Undhad
  • 487
  • 5
  • 8
1
vote
1 answer

JavaFX - Read Java-Class-String in FXML file

is there any possibility, that I can access a String Variable from a Java-Class and use the value in my fxml file? e.g. Java-Class: public class Strings{ ... static String MY_STRING = "Hello World!"; ... } FXML-File: ...