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

JavaFx TableView Columns don't fill the TableView Width

I have a TableView generated with SceneBuilder and all the columns are FXML imports from other views, until there no problem, but the columns don't fill the width. I tried to fix this with scene builder and FXML, but no luck, all the sizes are…
Ocirederf
  • 113
  • 1
  • 6
7
votes
2 answers

FXML minHeight & minWidth attributs ignored?

How can I set a minimum size to my window ? I try to set the minHeight minWidth value but I can still resize the Window under this values with the mouse. Here is my FXML root pane:
Jeankowkow
  • 814
  • 13
  • 33
7
votes
4 answers

JavaFX Button with transparent background

I have some classical Button in JavaFX with a box containing some text. I need buttons without that box, just the text, and when I hover the button or click on the button with mouse, it shall change its color to different.
Terra Incognita
  • 167
  • 2
  • 2
  • 11
7
votes
2 answers

How to style a SVG using CSS in javaFX FXML

I'm using SVG for an image in a button. But I'm not able to fill in color for it through CSS. Below is the code to render a button.
7
votes
2 answers

ListView styling in JavaFX

I have a listview. I want to change the color of the background and the text fill. I have tried doing the following: playlistView.setStyle("-fx-background-color: blue; -fx-text-fill: black;"); But, this doesn't work. However, the following is…
Ishrak
  • 509
  • 1
  • 9
  • 17
7
votes
2 answers

Javafx - Can application class be the controller class

I'm currently teaching myself JavaFX, and I've taken a simple example program that's hardcoded the view and am turning it into one that uses FXML (mostly so I can use SceneBuilder for building UIs). Rather than writing a separate controller class,…
Dave S.
  • 178
  • 1
  • 8
7
votes
2 answers

How to change fxml lable text by id

I have Label on my fxml file: How can i change the text from "Label" to "Hello" from the main/controller java file? I just started to learn the basics of JavaFX and i am not sure…
Oshrib
  • 1,789
  • 12
  • 40
  • 67
7
votes
1 answer

JAVA FXCollections LoadException Class is not a valid type

I'm trying to implement a TableView with some data with the help of this Tutorial. Im stuck on populating data from my "Person.java" to the TableView. I tracked the problem down to the part
Matthis Kohli
  • 1,877
  • 1
  • 21
  • 23
7
votes
6 answers

How to hide or deactivate a TextField and a Label with javafx

I would like to hide or deactivate a TextField and its Label in my JavaFX application. This is what I tried myTextField.setVisible(false); , but it's not working I use Eclipse V4.5.0 on windows 7 with jfx8 V2.0.0
David
  • 184
  • 2
  • 4
  • 20
7
votes
2 answers

How can I make constant variables in Javafx for XML files

StackPane layoutY="70.0" prefHeight="479.0". I want to make the values (70.0) and (479.0) static in a Java file so I can use them for other files. Is this possible?
Kyle Wolff
  • 141
  • 2
  • 10
7
votes
2 answers

JavaFX TextField : Automatically transform text to uppercase

I have a JavaFX TextField control on my FXMl that looks like this... I want to automatically change all characters to uppercase when the user is…
Martin
  • 474
  • 2
  • 6
  • 17
7
votes
2 answers

Remove arrow on JavaFX menuButton

Hi JavaFX Stylesheet expert, How do I remove the default arrow on JavaFX menuButton. I have figured how to change the color and make in unvisible with .menu-button { -fx-mark-color: transparent; } or .menu-button .arrow { …
Ivancodescratch
  • 405
  • 4
  • 14
7
votes
4 answers

how to make image buttons on java fxml using scene builder?

I am using netbeans and want to use media file from my desktop to replace the boring button. So this is my code. I want it so the image becomes the button.
7
votes
2 answers

Is it possible to use arithmetic expression in FXML?

I hoped for a feature that would allow me to work with numbers inside the FXML. For example, tried to define the height of one element to be equal to a constant and the height of the second element to be equal to the same constant multiplied by 2…
Radosław Łazarz
  • 950
  • 1
  • 11
  • 25
7
votes
3 answers

JavaFX: create a vertical menu ribbon

An example of what I am trying to accomplish here is: when you open an office Word 2013 file and you click file, in the left side it shows a list {Info, New, Open...}. Are there any JavaFX components like that? I am looking for a kind of List of…
usertest
  • 2,140
  • 4
  • 32
  • 51