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
4
votes
2 answers

JavaFX - handle MouseEntered event on a button (with fxml)

I'm trying to learn event handling and made an example with an fxml button that looked like that:
Mark
  • 69
  • 1
  • 1
  • 8
4
votes
1 answer

How to show only the JavaFX DatePicker calendar popup and no ComboBox in FXML?

I want to remove the ComboBox of a DatePicker and only show the Calendar of the DatePicker instead. Explained here: JavaFX extract calendar-popup from DatePicker / only show popup If I want to accomplish it in java I would do something…
7twenty7
  • 558
  • 1
  • 3
  • 16
4
votes
2 answers

JavaFX switch scene in Fullscreen

I want to switch the scenes of my JavaFX application in Fullscreen with a "Next"-Button. But if I click on that Button it switches from fullscreen to windowed and back to fullscreen within a second. How can I achieve to avoid that and stay in…
Nik
  • 179
  • 1
  • 3
  • 11
4
votes
1 answer

JavaFX: ClassNotFoundException for imported class in FXML

I'm trying to create a textfield with a title embedded in the field border like: Following the solution posted here I've created a .java file called TitledBorder.java within my src>main>java directory. My FXML is in the src>main>resources directory…
Casey B.
  • 279
  • 3
  • 13
4
votes
1 answer

How do I make my VBox and Label resize according to texts in label in JavaFx?

As you can see, my texts are constrained by labels. How do I make the label resize to exactly fit the text and also to resize the VBox and GridPane accordingly. I only want to resize vertically. My FXML:
aeruhxi
  • 556
  • 2
  • 5
  • 19
4
votes
6 answers

Cannot create FXML file in JavaFX project in Eclipse

OS: Ubuntu 14.04. IDE: (Eclipse Mars.1 Release (4.5.1)) and Scene builder 2. I can't choose root element because as I understand it should be done. This window I see when creating a file. Maybe I incorrectly set the path to my Scene Builder…
Kas Elvirov
  • 7,394
  • 4
  • 40
  • 62
4
votes
1 answer

Button with image (styling with FXML/CSS)

I have problem and don't have any idea how to solve it. I have button and I need to add image next to text on right. I did it but after resizing this button, image is always next to text. There is any solution to get text toleft and image to right…
Thulion
  • 97
  • 1
  • 11
4
votes
1 answer

How to get transparent list view in javafx?

I have a list view. I want to make the cells background transparent. Currently, I am doing the following: .list-cell { -fx-background-color: transparent; } But, the color of the cells remain white. I have tried the same with other colors. It…
Ishrak
  • 509
  • 1
  • 9
  • 17
4
votes
1 answer

JavaFX onKeyPressed event not being handled

I have a very basic JavaFX project with just an anchor pane and a label. The idea is that when you push a button on the keyboard, the label will change to the key you pressed. MainApp.java is very simple. Just load the FXML data and show it. …
user5339769
4
votes
1 answer

JavaFX UI will not shrink, after being expanded

OK, I've been on this all day, and can't seem to make any sense of what is going on. I have a TabPane, and within that, a Tab, the Tab's content is an AnchorPane, and within that, a SplitPane. On the right side of the SplitPane, I have a ScrollPane,…
Garry
  • 623
  • 1
  • 7
  • 11
4
votes
1 answer

Add regular JavaFX Node into FXML

So I have a regular component extending from BorderPane and I want to add it into some FXML code. I am getting java.lang.IllegalArgumentException: Unable to coerce SettingsTab to class javafx.scene.Node. SettingsTab extends BorderPane: public class…
Chris Smith
  • 2,928
  • 4
  • 27
  • 59
4
votes
2 answers

One controller to 2 fxmls (JavaFX)

Is possible to connect two FXML (JavaFX) files to one controller? I can't do this with changing "fx:controller" in each FXML file... Any ideas?
Balu
  • 43
  • 1
  • 1
  • 5
4
votes
2 answers

JAVA FX - Create observableHashMap inside fxml

How can I write hashMap inside an fxml. I tried like this, but my IDE doesn't recognize the "entry" tag name. This must create a Map
Domien
  • 395
  • 5
  • 18
4
votes
1 answer

Creating a large body of text with different styles - JavaFX FXML

In the fxml class of my JavaFx application I want to add a large body of text using minimal components (instead of adding multiple labels per line). I would also like to create varying styles of text in the same component. What component should I…
Josh Beaver
  • 127
  • 8
  • 18
4
votes
1 answer

-fx-border-style doesn't look as expected on runtime but on SceneBuilder

The following style looks as expected on SceneBuilder. (The only visible border is the bottom one and it is dotted.) But it looks different on runtime. (All borders are visible and solid.) .floatingPanel-title{ -fx-text-alignment: center; …
bAris
  • 111
  • 3
  • 9