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

JavaFX and the use of FXML created in scene builder

I have been trying to figure out how to use two FXML files and their controllers at the same time in a program, but have found it difficult to find a simple example. Would someone please demonstrate the use of Sample.fxml and Sample1.fxml at the…
1
vote
2 answers

Open Two Windows Simultaneously - JavaFX

I'm creating an application that will have a window over top of another, similar to the general idea seen here. I'm still new to JavaFX and am looking for a simple way of accomplishing this but with more complicated forms, each with their own .fxml…
Quinn McHugh
  • 1,577
  • 2
  • 17
  • 23
1
vote
0 answers

Loading fxml scene with many components takes too long

I am new to javafx and developing a desktop applicaiton using netbeans 7.4 and java version 7. In my project there are 2 fxml files, first one with less number of UI components and the other with too many components. When I navigate from first fxml…
1
vote
1 answer

JavaFX Data Mangement

Scene 1 with its Scene1Controller! it has a text field (Customer Name) and a button! When I click the button in scene 1, a on-screen keyboard will appear without closing the scene! on-screen keyboard has it has its own controller! on-screen…
1
vote
2 answers

How do I get my fxml and java classes to work together?

This is a class project where we needed to set up our GUI on an fxml doc. I have gotten the layout set on the fxml however I wasn't sure how I could get the buttons to print out statement or call methods that were in different java classes. I tried…
user2872131
  • 83
  • 2
  • 7
1
vote
1 answer

Full screen under JavaFX with FXML does not work

Please have a look at the code snippets: import java.io. *; * import java.sql.; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.image.Image; import java.io.BufferedReader; import java.io.InputStreamReader; import…
user3487276
  • 99
  • 4
  • 12
1
vote
1 answer

How implement javafx label value change listener

how call the listener when Label text changed Label myLabel= new Label("text1"); if i change the text myLabel.settext("text2"); There is any listener so that i can perform this myLabel.LISTENER{ System.out.println("Label Text Changed"); }
java baba
  • 2,199
  • 13
  • 33
  • 45
1
vote
2 answers

How to modify MenuButton arrow color by JavaFX not FXML CSS?

i am trying to modify color of MenuButton arrow , using JavaFX code not by CSS. i found it inside caspian.css : .menu-button > .arrow-button > .arrow { -fx-background-insets: 1 0 -1 0, 0; -fx-background-color: -fx-mark-highlight-color,…
Jason4Ever
  • 1,439
  • 4
  • 23
  • 43
1
vote
0 answers

JavaFX + FXML integration with Spring

I want to integrate javaFX with Spring IOC. For that I have found some valuable tutorial on steveonjava.com. Can any one please tell me with that "ScreensConfiguration" (as display on below) class, how I am going to load some Controller with…
Channa
  • 4,963
  • 14
  • 65
  • 97
1
vote
1 answer

Error message when (clicking menu item) opening a 2nd stage in Java8

Here was my original post: I have an application built in NetBeans 8/ Java8/JavaFX. (Note that I do not have SceneBuilder) My main application window is running fine. I have a menu item that calls the following function to open a second window: …
adeena
  • 4,027
  • 15
  • 40
  • 52
1
vote
1 answer

NullPointerException fx:include

When I do an fx:include in my fxml file, I got this error: Caused by: java.lang.NullPointerException at javafx.fxml.FXMLLoader.equals(FXMLLoader.java:1856) at javafx.fxml.FXMLLoader.isCyclic(FXMLLoader.java:1868) at…
Kiva
  • 9,193
  • 17
  • 62
  • 94
1
vote
0 answers

Best way to generate components from collections in JavaFX

Let's say I have a list of People. These people have a number of custom properties, first names, last names, addresses etc. What I want to do is create a "custom component" (some text fields etc), written in FXML, which represents a person. Then,…
jacheson
  • 1,303
  • 2
  • 12
  • 16
1
vote
1 answer

How can I set a graphic for a TreeItem in FXML?

I'm trying to configure the root node of my TreeView in FXML:
crush
  • 16,713
  • 9
  • 59
  • 100
1
vote
1 answer

Difference between accessing a javafx controller class with getController() and invoking the default constructor of the controller class

I have some doubts regarding accessing javafx controller class. I have seen that all of the time we use getController() method of FXMLLoader class to access a controller class. Why don't we use constructor invocation using new operator and…
Angom
  • 721
  • 1
  • 11
  • 27
1
vote
1 answer

Why Java Scene Builder is not showing the exact Background color when the program runs

I have made a window, some buttons and a textfield in Scene Builder. In Scene Builder: But when I run my program via netbeans or double clicking on the .jar file, its runs fine but just the color does not show. Background becomes white. And…
Tushar Monirul
  • 4,944
  • 9
  • 39
  • 49