Questions tagged [javafx]

The JavaFX platform enables developers to create and deploy Graphical User Interface (GUI) applications that behave consistently across multiple platforms. JavaFX 1.3 and older, were scripting languages, whereas JavaFX 2.x+/8.x enables users to use Java. FXML enables JavaFX to follow an MVC architecture.

The JavaFX platform enables developers to create and deploy Graphical User Interface (GUI) applications that behave consistently across multiple platforms. It is built on java technology and was part of the Oracle JDK from JDK 8 until Java 10. Since JDK 11, JavaFX is shipped as a library, independent of most JDK and JRE distributions.

External Resources

Tag Usage

  • javafx accumulates questions on all version as it tends to be used on the current version at the time the question is asked.
  • javafx-18 is dedicated to questions that are specific to the JavaFX 18 version.
  • javafx-17 is dedicated to questions that are specific to the JavaFX 17 version.
  • javafx-11 is dedicated to questions that are specific to the JavaFX 11 version.
  • javafx-8 is dedicated to questions that are specific to the JavaFX 8 version.

Outdated tags - do not use, instead update your environment to a recent version

  • javafx-2 is dedicated to questions that are specific to the JavaFX 2+ version.
  • javafx-1 is dedicated to questions that are specific to JavaFX 1.x releases which used JavaFX Script language

Frequently Asked Questions

People often ask these questions about this topic:

Installation

Resource Lookup

FXML

Packaging

Virtualized Controls

Misc

38047 questions
6
votes
1 answer

JavaFX Exception in Application constructor(No Such method found exception)

I am trying to convert a swing UI to a JavaFX one for a chat system that I am editing the source code for and I am getting error when I try to run the program. This is my Main Class: public class Main extends Application{ private Main() { …
forests
  • 345
  • 5
  • 11
6
votes
1 answer

Switch between themes in JavaFX

I developed a Java FX application and I use CSS for styling. The app uses the default colors for almost everything, so I've found that by simply adding in the .css a darker base: /* DarkTheme*/ .root { -fx-base: rgba(60, 60, 60, 255); } I get…
Lory A
  • 520
  • 1
  • 5
  • 17
6
votes
1 answer

Handling an exception not happening on my code, what should I do?

I have a JavaFX application that takes a screenshot/snapshot of a node. The code that takes the screenshot looks something like this: WritableImage image = webView.snapshot(null, null); where webView is a javafx.scene.web.WebView. Normally this…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
6
votes
1 answer

JavaFX TreeView java.lang.RuntimeException

I get the following exception when running a simple program demonstrating the use of the TreeView control: java.lang.RuntimeException: Error while creating node:class javafx.scene.layout.StackPane id:null The error occurs when expanding or closing…
jimbo8
  • 79
  • 3
6
votes
2 answers

Bad character spacing (kerning) in JavaFX's font rendering (in Linux)

I've started developing an application in JavaFX and I've run in an issue, I could find very little helpful information about: The spacing of between characters in Linux is very uneven. I'm not talking about the width of different characters but of…
Customizer
  • 665
  • 2
  • 7
  • 20
6
votes
1 answer

JavaFX Displaying properties in controls

I'm working through myself Oracle's JavaFX tutorials. After doing Swing for many years (a long time ago) I'm fascinated by the new smart features, incl. properties. I was surprised to see that these examples (e.g:…
parszab
  • 149
  • 7
6
votes
1 answer

Bringing a single stage to the front in windows in JavaFX

I am trying to create a stage in JavaFX that can pop up to the front in windows, while the main stage stays minimized. This only works however, when the main stage is visible on the screen. I have tried making it work using Modality, but then the…
RSloeserwij
  • 442
  • 3
  • 11
6
votes
2 answers

How to access resource using class loader in Java 9

I have a gradle project in eclipse. Here is the structure of my project I have css resource styleclass.css in scr/main/resources/css. First I tried to access it using scene.getStylesheets().add("css/styleclass.css"); But I was getting warning…
Basit
  • 8,426
  • 46
  • 116
  • 196
6
votes
1 answer

JavaFX Stage.close() not calling my onCloseRequest() handler

Please refer to the JavaFX SSCCE below. The print statement appears when closing the primary stage from the window's default titlebar "X" button. The print statement does NOT appear when clicking the "Close" button. Why isn't my onCloseHandler being…
BinaryDigit09
  • 110
  • 10
6
votes
3 answers

How do I set custom fonts from css in JavaFX?

I have added a custom font to my project in the src/main/resources folder (RobotoMono.ttf). Then I try to load it from my css file like this: @font-face { font-family: 'RobotoMono'; src: url('RobotoMono.ttf'); } but when I try to set this…
Hexworks
  • 514
  • 7
  • 17
6
votes
2 answers

Bind TextField to ReadOnlyDoubleProperty

I can bind a TextField's text property to a DoubleProperty, like this: textField.textProperty().bindBidirectional(someDoubleProperty, new NumberStringConverter()); But what if my someDoubleProperty is an instance of ReadOnlyDoubleProperty instead…
kerner1000
  • 3,382
  • 1
  • 37
  • 57
6
votes
2 answers

JavaFX Stage/Scene automatic resize

Like the picture showed, the red box above is a GridBox and below is a VBox with Splitpane (ListView) and Gridpane (2 Buttons). What I want to implement is to hide the VBox below, when the Button "Hide <<<" is clicked. But now, the red box below…
Lio Mou
  • 91
  • 1
  • 1
  • 5
6
votes
3 answers

Should I use SceneBuilder or implement layout in code?

I'm quite new to JavaFX and Java in general, but I've experienced something weird. At first, I took a Java course and there we were creating layout for application using SceneBuilder. I've finished the course and I'm trying to write some simple…
BigRedChick
  • 79
  • 1
  • 7
6
votes
2 answers

JavaFX SceneBuilder alternative

I have been facing serious issues with Scene Builder as it seems to freeze my desktop. Are there any alternative drag and drop GUI builders for JavaFX? Something like Android Studio where you can quickly switch between "Design" and "Text" would be…
Riasat Khan
  • 63
  • 1
  • 3
6
votes
2 answers

How does Platform.runLater() function?

I have a simple app which updates the data in the background and while it updates, it disables all the other buttons and enables a TextArea to show the progress. Steps: Disable all the other buttons in the mainUI (Button name: plotButton) Enable a…
Kavyajeet Bora
  • 612
  • 1
  • 7
  • 15
1 2 3
99
100