/r/JavaFX
JavaFX is an open source, next generation client application platform for desktop, mobile and embedded systems.
Useful resources (Full list)
Related subreddits
Other communities
/r/JavaFX
Hi.
I'm trying to get started with FXML, to create a simple Video player.
I've setup the following:
IntelliJ - latest version
Setup Java, Setup Environment Variables: added new JAVA_HOME, and added bin folder to PATH.
openjdk-23.0.2_windows-x64_bin
openjfx-23.0.2_windows-x64_bin-sdk
Scene Builder.
If I add just buttons in scene builder, it runs, i see the interface but I get the error:
Feb 02, 2025 11:30:43 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 23.0.1 by JavaFX runtime of version 17.0.6
If I add Media View, it no longer rungs, and I get the error:
Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at
javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465)
at
javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1164) Caused by: java.lang.RuntimeException: Exception in Application start method at
javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
at
javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1575) Caused by: javafx.fxml.LoadException:```
//path to hello-view.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2714) at javafx.fxml/javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2986) at javafx.fxml/javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2830) at javafx.fxml/javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2765) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2631) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2555) at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2523) at com.ddusoftware.vld/com.ddusoftware.vld.HelloApplication.start(HelloApplication.java:14) at
javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
at
javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at
javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at
javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at
javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at
javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more Caused by: java.lang.ClassNotFoundException: javafx.scene.media.MediaView at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528) at javafx.fxml/javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:3054) at javafx.fxml/javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:3043) at javafx.fxml/javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2984) ... 15 more Exception running application com.ddusoftware.vld.HelloApplication Process finished with exit code 1
What am I missing? The code I'm familiar with, the setup is killing me :(
Please someone explain why first statement works but not the other In both directory libraries are present. I am new to JavaFx so don't know much
purple pane is my parent pane, for which i used Anchor pane. But apparently it doesn't take max-width of available space (even if the max-width is set to computed)
Only facts:
Param | Compose Multiplatform | JavaFX |
---|---|---|
Language | Kotlin | Java |
Age | 5 years | 17 years |
License | Apache License 2 | GPL 2 + CPE |
Stars | 16.7k | 2.8k |
Forks | 1.2k | 489 |
Contributors | 156 | 90 |
I have some ideas for some projects I want to make that I'd like to run on Windows/Linux/OS X and also Android/iOS.
I've looked into various options, and I really like JavaFX and Gluon based on what it promises: A solution that allows you to write basically all of your code in Java and have it compiled to native across the environments I mentioned. That said, I've started to play around with it, and I find the documentation isn't great (it's more of a JavaDoc reference than some type of programmer guide), I find that there are some weird quirks and issues (for instance, I never managed to get anything to work properly when building with Gradle, but Maven seems fine), etc. And honestly, I'm quite worried that JavaFX/Gluon will be killed, or that it will simply deteriorate in terms of maintenance and usage will dwindle.
It seems that the most popular options aren't great for various reasons, such as performance issues, lack of Linux support, JavaScript (I really just don't like JavaScript). Nonetheless, I'm wondering if I should simply go with something more popular than JavaFX/Gluon. By picking a popular technology, I get a large community of people solving similar problems and writing libraries and stuff.
What is the status of JavaFX and Gluon today? Would you use these technologies for a new project? If not, what would you use instead?
Hey, I want to create a custom Cell Factory for the drop down menu in the choice dialog like I already did it for a normal ComboBox, but there does not seem a way to do that.
Am I doing something wrong or is there no way to do that?
I have always understood scene as the white plain surface on the stage(like a canvas). I know the root node is placed in it. Can you tell if i should use pane such as anchor pane for the following purple container on the right side
The purple container should show content based on click on various button('dashboard', 'Available Room' ) placed on left side of the screen.
The reason for my confusion is that there is option to add a scene in Scene Builder. So what basically is scene?
I use AtlantaFX for Javafx styling. This is a great library and I am sure everyone knows it. But can anyone suggest other libraries?
I can't see the drop down option that shows available methods of my corresponding controller class (to use for my Button)
tried annotating both the button and the method with @ fxml
I am working with JavaFX development, and it seems to me that today, for new projects focused on creating desktop UIs, it should be used. However, just recently on r/java there was a question - Anyone still using JavaFX? That made me wonder – what could be the reasons not to use JavaFX?
There are companies that provide commercial support, for example Gluon. Besides I was once asked by oracle employer (we were talking about javafx) if I had a subscription(???). Taking into consideration that UI bugs can seriously decrease the quality of the product does anyone buy commercial support? If so, what is its price?
GPT was calling the path as root classpath and said it's informal
[DUMB Mistake- SOLVED)
I am using maven build (inside IntelliJ), and have kept my image under resources/images folder. My app is running but image is not rendering, though in the final build i can see my images folder with bank_logo.png (view
My code:
Group root = new Group();
Image bankImg = new Image(getClass().getResource("/images/bank_logo.png").toExternalForm());
ImageView imageView = new ImageView(bankImg);
imageView.setX(100);
imageView.setY(200);
root.getChildren().add(imageView);
I have also tried using input stream by
InputStream inputStream = Main.class.getResourceAsStream("images/bank_logo.png");
Image bankImg = new Image(inputStream);
and got "Input stream must not be null" exception //idk why
I have also tried using other methods stated in Img Not displayed articles such as using file: and putting the img directly under src/main and using the absolute path. But none of them helped, sadly.
Like how do I share it with other people.
I'm working on developing an application that helps manage store items efficiently and visually represents the data using a pie chart. The goal is to make it easier to track inventory, analyze stock distribution, and gain insights into sales or product categories. I've already experimented with some functions, but I'm still refining the implementation to ensure accuracy and usability.
I'm working on a UI part, which is basically a list of directories and its contents
Whenever you select the ChoiceBox, there is a list of subfolders.
I have a ChangeListener hooked up to ChoiceBox, which basically calls
listView.getItems().clear();
listView.getItems().addAll(...);
listView.refresh();
If I'm switching content of listView from 10 elements to 3 (from `Interrogator` to `Pariah Nexus`) I'm getting leftovers.
And the leftovers are not clickable. Just a graphical glitch.
How to address this?
Started working on an app (still brainstorming the details)
With a structure of
But whatever I try, I can't really make a ScrollPane to stretch to the dimensions of the parent AnchorPane(the VBox is one of many attempts to maybe make it right).
I confess that it has been quite a while (6+ years) the last time I read (it took me a while to find this documentation) the details for each JavaFX element and how they function.
I did manage to make it achieve what I wanted through code, adding a listener to Anchor's height property, but the question is - is it my lack of knowledge how to properly work with this type of elements? Or its simply how the things are(maybe I needed to add CSS to make it work)?
UPD: my bad. Wrote ScrollPane instead of the next in line ListView, which is the problem I'm facing.
The tray menu available looks very old looking, is there a way to get the modern look such as discord for example ?
Thanks in advance
Is it possible to combine several
```
\@FXML private TextField myField
```
into a separate class, which then would be used in a `\@FxmlView`?
When I resize the application window every object moves and not properly resizing. Especially imageview object. Kindly share tutorials or documents to set up responsive UI in javaFX.
Hi, I am a newbie in javaFx doing a project with it for a course. I am facing some problems regarding menu item. To clarity let me explain in details. I had three buttons- logout, help, settings, corresponding buttons were performing their functions(like loging out, shifting scene to to settings)
Then my faculty asked me to do this with menu bar. When I am doing this with menu bar and setting the same code for the menu items they ar not working at all. What could be the problem? Is there any specific source to learn about this easily?TIA.
Could someone please forward me to a working doc/example/tutorial for adding JavaFX (openjfx or smt) to an existing SpringBoot 2 project?
I've tied the observableList to the extent of the 'Studio' class. In this way:
ListView<Studio> studioListView = (ListView<Studio>) scene.getRoot().lookup("#studioListView");
studioListView.setEditable(false);
studioListView.getSelectionModel().setSelectionMode(SelectionMode.
SINGLE
);
ObservableList<Studio> studioList = FXCollections.
observableList
(
grabStudioExtent
());
studioListView.setItems(studioList);
The problem I'm having is when new objects are added to the extent, the list updates and shows them, however I can't select them in the ListView anymore. I've looked around on the internet for a solution but can't seem to find anything.
I created this app because I use Ikonli a lot. There are tons of icons, and at this time, they do not have a complete icon browser. Their browser is in the works.
My browser will allow users to search all icons, search icons by provider, browse all icons, or browse icons by provider.
Improvements I would like to see in the future:
Link to repo -> https://github.com/sedj601/IkonliIconBrowser
Try it! If you find bugs or want to see improvements, let me know.
For the file upload area I have it set up so that there is an Hbox whose children are the Vbox containing both labels and the button to the right. How do I get the button to align with the middle of the two labels? (moving it down a few pixels essentially)
Thanks!
Hey,
I am trying to figure out why my *.fxml are not loaded in my JavaFX + Afterburner.fx app.
I made a question with details here: https://stackoverflow.com/q/79348850/17985451
Help would be kindly appreciated.
Thanks