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
1 answer

JavaFX/SceneBuilder - Changing only PART of a Scene

I'm a total newbie in JavaFX and I haven't found any tutorial/answer about this matter. So basically what I'd like to do is change only part of my Scene. I want to keep a static menu bar at the top and only change the bottom part according to which…
Yar Mommy
  • 55
  • 9
4
votes
2 answers

Loading multiple fxml in javafx

I've been searching for a while and I haven't been able to get what I wanted to do. I've been using the javafx framework to switch fxml in javafx in this thread 'Loading new fxml in the same scene' with some success. I mean, I have a main window,…
JFValdes
  • 426
  • 8
  • 19
4
votes
1 answer

java.lang.NullPointerException it works, but error. Trying to find the error

I have an error when I click "start button", it loads me a new fxml where I will play with it, it works fine, but console says me this error.. I cannot understand how to solve it. My FXML: (Look only to startGame, that gives me some problems) …
Alberto32
  • 229
  • 1
  • 4
  • 14
4
votes
0 answers

JavaFX - Adding buttons dynamically to fxml created VBox

I am trying to add x number of buttons to a VBox located in a scrollpane. The Vbox, and scrollpane are made with scenebuilder. However i can't seem to connect the VBox to the controller as a variable. The piece of code that spawns the scene is the…
Danfjo
  • 73
  • 2
  • 7
4
votes
1 answer

javafx - load FXML file inside Controller, but also use NetBeans's "Make Controller"

While trying to load an FXML file, one usually does something like the following: FXMLLoader loader = FXMLLoader.load(getClass().getResource("File.fxml")); Region root = loader.load(); Stage stage = new Stage(); stage.setScene(new…
Ignatiamus
  • 296
  • 1
  • 12
4
votes
1 answer

JavaFX - Display background of a disabled Label

With JavaFX, I would like to display a Label with a defined background color (when disabled, my Label's background becomes transparent), and I tried the code below, but that still doesn't work... Have you some tips for me? - Another thread told me…
4
votes
2 answers

Javafx packegs do not Exist IntelliJ

I'm trying to code my first Javafx Application. But I keep getting an error even though my application is ok with the syntax. It's ok because I use the default one when initializing the first JavaFx application in IntelliJ . This here is my…
4
votes
2 answers

How to trigger an event on focus out for a textfield in javafx using fxml?

I have this function in the controller class of the relevant fxml. I need this function to be fired on focus out from a textfield, but scene builder doesn't have an event similar to onfocusout. How to achieve this using the control…
v1shva
  • 1,261
  • 3
  • 13
  • 28
4
votes
2 answers

JavaFX Label not updating with setText()

I have done a lot of searching and cannot seem to find a solution to my problem, I am trying to get the label selectedName to update when the user enters his/her name inside Intro.fxml and appear on Main.fxml. However it still appears as…
benjay_uk
  • 107
  • 2
  • 8
4
votes
2 answers

JavaFX adding and removing Node from BorderPane

I want to programmatically add and remove side menu in BorderPane. Problem is when I add a Node, it is not visible. BorderPane and StackPane are defined in FXML file. I want to do something like this: StackPane temp = (StackPane)…
Milorad
  • 152
  • 2
  • 10
4
votes
0 answers

How to get the controller of an included FXML layout

I'm using javaFX. I have an FXML layout with no controller that includes two layouts like so
Suemayah Eldursi
  • 969
  • 4
  • 14
  • 36
4
votes
4 answers

In javafx loading FXML file from another package and error appear?

I am facing problem in loading fxml file from different packge. Project Structure My class that loads the FXML file PlayArea.java looks like this: package controller; import javafx.application.Application; import javafx.fxml.FXMLLoader; import…
badarshahzad
  • 1,227
  • 16
  • 25
4
votes
2 answers

JavaFX: Create custom data attributes for nodes

I am currently in need of custom attributes which I can fetch anytime. Is there any way to create custom data attributes for nodes and then get those values in javafx? Lets assume I have the the follwing Button.
4
votes
0 answers

How to deploy JavaFX project using Android Studio?

I am writing a program which I would like to deploy as both desktop and android applications. I want to use JavaFX 2.0 with FXML for the desktop side of things. I want to work entirely in Android Studio. Right now, I am just concerned about…
Aralox
  • 1,441
  • 1
  • 24
  • 44
4
votes
0 answers

Javafx tableview scrolling is too slow

I've made a Tableview in Javafx that show 100.000 rows ,but the problem's the scrolling is too slow , please if any one has any idea about that !!.. bitbucket.org/JdevY/tableview-performance // it works well if i make…
z.yahia
  • 41
  • 2