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

sort tableview with drag and drop (rows)

my aim is to sort a tableview with drag and drop. I followed this example: http://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm For drag and drop I added the fxml via Scene Builder
schasoli
  • 317
  • 1
  • 3
  • 12
10
votes
2 answers

scene builder won't open

When i right click the FXML document and click open with scene builder the scene builder opens on my taskbar but if i click it, it will not show anything can anyone please help me? package application; import javafx.application.Application; …
10
votes
1 answer

JavaFX custom controller factory

I have been experimenting with the FXMLLoader and using the setControllerFactory method using a custom Callback implementation. The ORACLE documentation says the following: An implementation might return a null value to indicate that it does …
Benjamin Gale
  • 12,977
  • 6
  • 62
  • 100
10
votes
2 answers

JavaFX custom control (TextField) not working

I am trying to make a custom control with JavaFX and SceneBuilder 1.1. I have this code: FXML
xigoa
  • 109
  • 1
  • 5
10
votes
6 answers

How to call functions on the stage in JavaFX's controller file

I am using javafx along with fxml, so I use the controller for the real coding. I need to do a few operations on the stage, such as getting its x- or y-axis position. I have tried stage.getX() & stage.getY, but they don't work(the stage name is…
Pratik Anand
  • 795
  • 5
  • 10
  • 19
10
votes
2 answers

Subcontroller not being injected into main controller

I have a BorderPane (associated with a MainController), the FXML for the BorderPane uses to include a Label (with a controller StatusBarController) into the bottom region of the BorderPane. Unfortunately the the StatusBarController is…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
10
votes
1 answer

FXML set TableView column resize policy

How can I set a TableView's resize policy from FXML? I tired this way, but it's not working:
Lakatos Gyula
  • 3,949
  • 7
  • 35
  • 56
10
votes
3 answers

JavaFX2 - very poor performance when adding custom made (fxml)panels to gridpane dynamically

Problem I want to add custom made panels, built via javafx scene builder, to a gridpane at runtime. My custom made panel exsits of buttons, labels and so on. My Attempt I tried to extend from pane... public class Celli extends Pane{ public…
user1562969
  • 155
  • 1
  • 2
  • 7
9
votes
5 answers

What is the best way to design the GUI in javafx 2.0?

In javafx 2.0 it is possible to create the layout by using FXML approach or by using normal java code. What is the best way with respect to a well designed set of UIs. In my application there is about 100 sub UIs. Thanks
Sachin Perera
  • 93
  • 1
  • 3
9
votes
1 answer

What's the correct to make FXML members in Java 9 or 10?

After upgrading to Java 10 (from 8), I'm getting these errors: InaccessibleObjectException: Unable to make field private javafx.scene.control.Button tech.flexpoint.dashman.controllers.configurator.RegistrationController.registerButton accessible:…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
9
votes
3 answers

How to add background-image to AnchorPane by using Scene Builder in JavaFX?

How add background image to an AnchorPane by using Scene Builder? I've tried it as: -fx-background-image url('C:/Users/Documents/page_background.gif') How I set this in Scene Builder. And the generated FXML:
pen1993
  • 231
  • 1
  • 4
  • 12
9
votes
1 answer

How to align center Label in JavaFX / FXML?

How can I center the text of a Label in javafx ? In the .css stylesheet or directly in the fxml. I tried Label { -fx-text-alignment: center;} in the .css but it does not work. Even in the scene builder it does not work.
Mourad Qqch
  • 373
  • 1
  • 5
  • 16
9
votes
3 answers

How to hide the TabBar in TabPane?

I am trying to build a Next/Previous windows using TabPane. I decided to use TabPane as it is easy to use and design in SceneBuilder. At the start fo the app, I used this to hide the TabBar for…
Dipu
  • 6,999
  • 4
  • 31
  • 48
9
votes
2 answers

How to create an Integer spinner with FXML

I am trying to create an Integer Spinner, but instead, a Double one is created instead. Test.class package com.neonorb.test; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.geometry.Insets; import…
Chris Smith
  • 2,928
  • 4
  • 27
  • 59
9
votes
1 answer

How to create an FXML file for an already created new component in java than add it to scene builder?

I'm new to javaFX. I created a customized Search box (extends TextField) in java, check image: I tested it with a test class and it's working. I want to know now if it's possible to create its FXML file than add this component to scene builder ?…
ben
  • 143
  • 1
  • 8