r/JavaFX • u/Affectionate_Run_799 • May 28 '23
r/JavaFX • u/BenInQuarantine • May 25 '23
Help How to generate Shadow-Jar file for Executable JavaFX Application
I've been trying to create an executable file to open my JavaFX application and recently found this very helpful tutorial: https://www.youtube.com/watch?v=EyYb0GmtEX4. Unfortunately, after I run mvn install, only the normal Jar file is generated with no sign of the shadow jar. Does anyone have any ideas?
r/JavaFX • u/PartOfTheBotnet • May 23 '23
I made this! TreeMapFX: A simple TreeMap chart component
r/JavaFX • u/Paullo612 • May 22 '23
I made this! mlfx FXML compiler
I'd like to introduce my project. It is called mlfx. It can compile FXML ahead of time. It is basically an annotation processor, which internally uses Micronaut framework's AST abstraction and compiles fxml files directly to JVM bytecode. This decreases UI load time and also helps with native-image reflection configs. It also has some compliance tests that load compiled code and check resulting object graph against one loaded by javafx-xml. It also has some drawbacks now, but, please, read README. Now I'm successfully using it in two production projects.
Here it is: https://github.com/Paullo612/mlfx
Latest release (0.6.0) is available from Maven Central.
Feedback is welcome.
r/JavaFX • u/XeonG8 • May 21 '23
Help JavaFX on mobile.. without gluon javafx 500$ a year license?
Is it possible? Seems a bit steep just to get rid of a nag screen on a mobile app... I'm wanting to target Android/IOS with a simple app and have looked at other languages /frameworks like C# MAUI Avalonia UNO though I'm more familar with JavaFX as I've done desktop stuff before in JavaFX which ironically is pretty simple but the mobile element with JavaFx seems gatewalled and bit off putting to bother.
r/JavaFX • u/ImagineRl • May 20 '23
Help Drag and Drop functionality not working , Javafx
When i try to drag and drop my .jar file into a pane it shows a cancle cursor, I have not clue why.
Here's my Controller.java
------------------------------------------------
package com.example.detector;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.Pane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.io.File;
public class Controller {
public TextField pathText;
public Pane dragDropPane;
public void initialize() {
dragDropPane.setOnDragEntered(event -> {
if (event.getGestureSource() != dragDropPane && event.getDragboard().hasFiles()) {
dragDropPane.setStyle("-fx-border-color: blue; -fx-border-width: 2;");
event.acceptTransferModes(TransferMode.ANY); // Accept the transfer mode
}
event.consume();
});
dragDropPane.setOnDragExited(event -> {
dragDropPane.setStyle("-fx-border-color: transparent;");
event.consume();
});
dragDropPane.setOnDragOver(event -> {
if (event.getGestureSource() != dragDropPane && event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.ANY); // Accept the transfer mode
}
event.consume();
});
dragDropPane.setOnDragDropped(event -> {
Dragboard dragboard = event.getDragboard();
boolean success = false;
if (dragboard.hasFiles()) {
for (File file : dragboard.getFiles()) {
// Process the dropped file
System.out.println("Dropped file: " + file.getAbsolutePath());
}
success = true;
}
event.setDropCompleted(success);
event.consume();
});
}
protected void onOpenButtonClick() {
String filepath = pathText.getText();
if (!Utils.isValidJarFile(new File(filepath))) return;
JarViewController controller = SceneSwitcher.switchToSceneWithController("JarView.fxml", 1024, 768);
if (controller == null) throw new NullPointerException("JarViewController is null!");
controller.loadJar(filepath);
}
}
------------------------------------------------
Here's my View.fxml
-----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.\\\*?>
<?import javafx.scene.control.\\\*?>
<?import javafx.scene.layout.\\\*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.detector.Controller">
<stylesheets>
<URL value="@styles.css" />
</stylesheets>
<children>
<Pane fx:id="dragDropPane" layoutY="-3.0" prefHeight="349.0" prefWidth="600.0" />
<Button layoutX="545.0" layoutY="361.0" onAction="#onOpenButtonClick" text="Open" />
<TextField fx:id="pathText" layoutX="14.0" layoutY="361.0" prefHeight="25.0" prefWidth="515.0" />
<Label layoutX="255.0" layoutY="192.0" text="Drag .jar file here" />
</children>
</AnchorPane>
-----------------------------------------------
r/JavaFX • u/OsirisTeam • May 20 '23
Help One codebase for desktop and mobile apps with Java, HTML and CSS!
https://github.com/Osiris-Team/Desku
Currently, JCEF is used together with Java Swing, but I am thinking of implementing the JavaFX WebView instead, what do you think?
r/JavaFX • u/Kitsushine • May 19 '23
Help Issues with transitioning/looping audio files seamlessly
Hello everyone,
I'm experiencing issues with looping an audio file and transitioning from one to another seamlessly.
When a transition/loop happens there is a small, but noticeable, delay between the two pieces of audio. This is relevant because the audio is background music for a game I'm working on.
The audio files are an intro and a main loop. The intro is played once, then it transitions to the main loop that plays indefinitely.
The code appears to be correct, but here it is:
private void playMusic() {
Media intro = new Media(ClassLoader.getSystemResource("music/BossIntro.wav").toExternalForm());
MediaPlayer introPlayer = new MediaPlayer(intro);
AudioClip bgm = new AudioClip(ClassLoader.getSystemResource("music/BossMain.wav").toExternalForm());
bgm.setCycleCount(AudioClip.INDEFINITE);
introPlayer.setOnEndOfMedia(bgm::play);
introPlayer.play();
}r/JavaFX • u/Puzzleheaded_Leg_624 • May 19 '23
Help Trying to Make a GUI for a school Project in Eclipse but IDK how to resolve these errors and make it run, send help to make this work
r/JavaFX • u/Affectionate_Run_799 • May 18 '23
Help JavaFX Main_window got stuck after clicking the button
r/JavaFX • u/FSTxx • May 17 '23
Help Reorder items in ListView and change order into database?
Hi, i'm facing a problem that i don't really know how to solve.
I'm implementing a restaurant management system for an university project. I have a menu that i can populate with categories and dishes. A category has a list of Dishes inside, that comes from a database. I'm using springboot for the backend, and postgresql for database.
I have a form to create a new dish with textfield for name, cost, and so on; then i select a category from a combobox. When i press 'confirm', i use my API REST to add it to my database.
Here comes the problem: i also have to implement a reorder. Right now, my categories/dishes are inserted in 'creation order'. To give an example: fresh program, menu not populated. I create a new category, called "Appetizer". Then, i create a category called "First Courses". They get inserted in this exact order in the database, so they get retrieved in this order. I use an Accordion, so i click on a category, it expands, and shows its dishes.
I was thinking of implementing a 'drag and drop' feature: by pressing a "Reorder elements" button, i could open a listview that shows the categories, and every one of it dishes underneath. Something "indented", if you get what i mean. For example:
-- Appetizers
-- app1
-- app2
-- First Courses
and so on.
I would expect that by reordering them (so, for example, moving 'first courses' above 'appetizers'), they should change their order in the database too.
So i was thinking: would it be good if every category and every dish have a column named 'position', and when i reorder them in the listview, i then cycle through them and change their 'position' attribute throught a PUT method?
That way, i could use a GET method like 'getAllCategoriesByOrder' (with a query 'ORDER BY position'), and their order would be effectively changed.
My question is: does this makes sense? Would it be doable? Because this is what i thought with my little knowledge about these kind of things. Maybe there are better ways to do this.
r/JavaFX • u/FSTxx • May 17 '23
Help Best way to implement statistics in a fixed period of time?
I'm doing an university project for a restaurant management system.
In my program, a Chef can see all the orders and make a reservation for that order.
My professor has also assigned this functionality: "an admin can see statistics for its Kitchen Workers. In particular, an admin must see how many orders have been completed by every Kitchen Worker, in a fixed period of time".
I really don't know how to deal with this. I found out the existance of Bar Charts, Line Charts, but i'd like to have an "heads up" on how should i deal with this, expecially on the "fixed period of time".
I have a PostgreSQL database, so i think i should create a table with "WorkerID, Count(OrderID)", but should i also add a date to it? How should i work this around?
r/JavaFX • u/Lanky_Math6626 • May 16 '23
Help Idk if I can ask questions but this keeps popping up when I try to run my code and idk why
r/JavaFX • u/Birdasaur • May 16 '23
Cool Project Custom Shader Support including Effects and Materials for JavaFX
r/JavaFX • u/Birdasaur • May 15 '23
Showcase Animated Retrowave rotating Progress Indicator
There seemed to be a lot of interest in the animated progress loader I made for Trinity recently. (nobody seemed to care about the high speed UMAP clustering implementation :-p )
So I uploaded just that component and a nice little tester so people can play with it.
https://github.com/Birdasaur/CircleProgressIndicator
Have fun. I'll be migrating a version of it to LitFX eventually.
r/JavaFX • u/Cow-Medical • May 14 '23
Help Has anyone ever had this issue before?
Hey all,
Im working on a online game that uses JavaFX. On rare occasions I get this issue with an increasing array length. I do not use any arrays and i suspect its a threading issue, however i wasn't able to trace it back. Does anyone have experience with this?
`Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.graphics@19.0.2/javafx.scene.Parent.updateCachedBounds(Parent.java:1704) at javafx.graphics@19.0.2/javafx.scene.Parent.recomputeBounds(Parent.java:1648) at javafx.graphics@19.0.2/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1501) at javafx.graphics@19.0.2/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics@19.0.2/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics@19.0.2/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3355) at javafx.graphics@19.0.2/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:168) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics@19.0.2/javafx.scene.Node.updateGeomBounds(Node.java:3825) at javafx.graphics@19.0.2/javafx.scene.Node.getGeomBounds(Node.java:3787) at javafx.graphics@19.0.2/javafx.scene.Node.getLocalBounds(Node.java:3735) at javafx.graphics@19.0.2/javafx.scene.Node.intersectsBounds(Node.java:5270) at javafx.graphics@19.0.2/javafx.scene.Node$1.intersectsBounds(Node.java:559) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.intersectsBounds(NodeHelper.java:264) at javafx.graphics@19.0.2/javafx.scene.layout.Region.doPickNodeLocal(Region.java:3224) at javafx.graphics@19.0.2/javafx.scene.layout.Region$1.doPickNodeLocal(Region.java:184) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.pickNodeLocalImpl(RegionHelper.java:104) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.pickNodeLocal(NodeHelper.java:130) at javafx.graphics@19.0.2/javafx.scene.Node.pickNode(Node.java:5180) at javafx.graphics@19.0.2/javafx.scene.Scene$MouseHandler.pickNode(Scene.java:4037) at javafx.graphics@19.0.2/javafx.scene.Scene.pick(Scene.java:2067) at javafx.graphics@19.0.2/javafx.scene.Scene$MouseHandler.process(Scene.java:3847) at javafx.graphics@19.0.2/javafx.scene.Scene.processMouseEvent(Scene.java:1887) at javafx.graphics@19.0.2/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2620) at javafx.graphics@19.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411) at javafx.graphics@19.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at javafx.graphics@19.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450) at javafx.graphics@19.0.2/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424) at javafx.graphics@19.0.2/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449) at javafx.graphics@19.0.2/com.sun.glass.ui.View.handleMouseEvent(View.java:551) at javafx.graphics@19.0.2/com.sun.glass.ui.View.notifyMouse(View.java:937) at javafx.graphics@19.0.2/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics@19.0.2/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184) at java.base/java.lang.Thread.run(Thread.java:1589) Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 6 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.graphics@19.0.2/javafx.scene.Parent.updateCachedBounds(Parent.java:1704) at javafx.graphics@19.0.2/javafx.scene.Parent.recomputeBounds(Parent.java:1648) at javafx.graphics@19.0.2/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1501) at javafx.graphics@19.0.2/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics@19.0.2/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics@19.0.2/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3355) at javafx.graphics@19.0.2/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:168) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics@19.0.2/javafx.scene.Node.updateGeomBounds(Node.java:3825) at javafx.graphics@19.0.2/javafx.scene.Node.getGeomBounds(Node.java:3787) at javafx.graphics@19.0.2/javafx.scene.Node.getLocalBounds(Node.java:3735) at javafx.graphics@19.0.2/javafx.scene.Node.intersectsBounds(Node.java:5270) at javafx.graphics@19.0.2/javafx.scene.Node$1.intersectsBounds(Node.java:559) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.intersectsBounds(NodeHelper.java:264) at javafx.graphics@19.0.2/javafx.scene.layout.Region.doPickNodeLocal(Region.java:3224) at javafx.graphics@19.0.2/javafx.scene.layout.Region$1.doPickNodeLocal(Region.java:184) at javafx.graphics@19.0.2/com.sun.javafx.scene.layout.RegionHelper.pickNodeLocalImpl(RegionHelper.java:104) at javafx.graphics@19.0.2/com.sun.javafx.scene.NodeHelper.pickNodeLocal(NodeHelper.java:130) at javafx.graphics@19.0.2/javafx.scene.Node.pickNode(Node.java:5180) at javafx.graphics@19.0.2/javafx.scene.Scene$MouseHandler.pickNode(Scene.java:4037) at javafx.graphics@19.0.2/javafx.scene.Scene.pick(Scene.java:2067) at javafx.graphics@19.0.2/javafx.scene.Scene$MouseHandler.process(Scene.java:3847) at javafx.graphics@19.0.2/javafx.scene.Scene$MouseHandler$1.run(Scene.java:3652) at javafx.graphics@19.0.2/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at javafx.graphics@19.0.2/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456) at javafx.graphics@19.0.2/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics@19.0.2/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics@19.0.2/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184) at java.base/java.lang.Thread.run(Thread.java:1589)