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
3 answers

FXML Load Exception no resources specified

I am starting to build a program with SceneBuilder and JetBrains IDE, i want to internationalize the program so i made a properties file. Everything works fine on the SceneBuilder but when i try to run the program with JetBrains i get this…
P_Ferreira
  • 363
  • 1
  • 4
  • 21
5
votes
1 answer

How to set default color for ColorPicker in FXML

Is it possible to set the default color of a ColorPicker in FXML, or do I have to set the color in the FXML controllers initialize method?
Aleksander H.
  • 53
  • 1
  • 3
5
votes
1 answer

Set custom FXML properties as parameters for custom javafx component

I created custom component TableBlock. It consists of a Label and TableView. TableViewcan have, for example, from 1 to 1000 rows. Number of rows is defined by parameter "rowsFromPrefs" in FXML file. This parameter is needed for creation of…
Dmitry Lazarev
  • 117
  • 1
  • 7
5
votes
1 answer

JavaFX Text inside Pane Layout is overlapping other Elements when using translateX() and translateY()

The image below is the description of what is happening: I have a Pane which contains a Text and i am using the code below to make a marquee like effect of the Text . So when the Pane has not enough space to display the text , an animation is…
GOXR3PLUS
  • 6,877
  • 9
  • 44
  • 93
5
votes
1 answer

How to define an editable TableCell in FXML?

I followed this Oracle tutorial to create a TableView in FXML. However there is no info on how to make a cell editable. I have tried other tutorials suggesting to add something like firstNameCol.setOnEditCommit( new EventHandler ... into the…
Leprechaun
  • 852
  • 6
  • 25
5
votes
4 answers

NullPointerException in JavaFX controller

My project is really simple atm. It has two TextFields named latField and longField. All I'm trying to do is print the string values contained in these fields using the getText() method, and occasionally set them using the setText() method. Note…
Lomesh
  • 123
  • 1
  • 9
5
votes
1 answer

Javafx button sending arguments to ActionEvent function

I'm learning how to use javafx, along with scenebuilder by creating a very basic calculator but I've come across a problem where it's hard for me to find a way to not have a seperate function for each button. I need to know if there's a way for a…
Foo
  • 53
  • 1
  • 1
  • 4
5
votes
1 answer

How can I set the margin of a BorderPane in fxml?

I am trying to run this fxml code in javafx:
zephos2014
  • 331
  • 1
  • 2
  • 13
5
votes
1 answer

FXML Doccument refusing to import other fxml files

I have a main FXML document for my program which contains a TabPane. For each tab I want it to have its own controller and fxml file. When I try to include the external fmxl files into the main fxml document, my program refuses to run. here is my…
user6129465
5
votes
1 answer

JavaFX - setText() is not working

I cant set the text of a Textfield. There is no error but the Textfield is still empty. The rest of the program is working, the method is called and the System.out.println(...) prints the right text. So the problem is, the text of the textfield cant…
Nik
  • 179
  • 1
  • 3
  • 11
5
votes
2 answers

JavaFx ImageView won't resize on fitWidthProperty bind to VBox

I am trying to re-size an image so it fits (scaled) in the space allotted by a SplitPane (for workaround suggestions: this image will change when running the program, it should be generated from the text). The ImageView I'm using currently changes…
user1658374
  • 51
  • 1
  • 3
5
votes
1 answer

How to delete selected row from TableView? (JavaFX with FXML)

So, I'm trying to delete the highlighted row in TableView in my program. I've looked at loads of tutorials online, but really can't get my head around this. I have followed the example from CodeMakery, which is in Eclipse, but I'm unable to get it…
april21
  • 115
  • 2
  • 9
5
votes
1 answer

JavaFX Scene Builder - Using Variable Values

I'm trying to use Scene Builder to handle a complicated GUI I'm working on and for the sake of simplicity I'm trying to fix the window's height and width to half of the user's screen height. The problem I'm encountering is that Scene Builder won't…
steinybear
  • 51
  • 2
5
votes
1 answer

javaFX width css not reacting?

Im trying to get a dynamic scrollpane in my JavaFX (FXML) application using CSS. my CSS for the scrollpane looks like this: .scroll-pane { -fx-width: 80%; -fx-height: 80%; -fx-background-color: #FF3333; } the color works, but the…
Edwinhai
  • 67
  • 1
  • 1
  • 7
5
votes
1 answer

Initialize Spinner control in fxml

New JDK is here: JDK 8u40 release includes new JavaFX UI controls; a spinner control, formatted-text support, and a standard set of alert dialogs. I want to initiliaze the Spinner with an IntegerSpinnerValueFactory in fxml. I tried like the…
Arikado
  • 65
  • 1
  • 6