r/JavaFX • • May 31 '23

Release AtlantaFX 2.0 released

32 Upvotes

Several new controls, three new themes, BBCode markup support and new Sampler app.

The full changelog is here: https://github.com/mkpaz/atlantafx/releases/tag/v2.0.0


r/JavaFX • • May 29 '23

I made this! Creating a game using Java

13 Upvotes

Hello everyone, i am game developer and new in the comunity. I wanna learn so much with you guys👊😭


r/JavaFX • • May 28 '23

Help I can't execute jar file after launch4j conversion. What I do wrong ?

1 Upvotes

r/JavaFX • • May 25 '23

Help How to generate Shadow-Jar file for Executable JavaFX Application

6 Upvotes

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 • • May 23 '23

I made this! TreeMapFX: A simple TreeMap chart component

39 Upvotes

r/JavaFX • • May 22 '23

I made this! mlfx FXML compiler

20 Upvotes

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 • • May 21 '23

Help JavaFX on mobile.. without gluon javafx 500$ a year license?

15 Upvotes

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 • • May 20 '23

Help Drag and Drop functionality not working , Javafx

2 Upvotes

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 {

u/FXML

public TextField pathText;

u/FXML

public Pane dragDropPane;

u/FXML

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();

});

}

u/FXML

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 • • May 20 '23

Help One codebase for desktop and mobile apps with Java, HTML and CSS!

4 Upvotes

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 • • May 19 '23

Help Issues with transitioning/looping audio files seamlessly

4 Upvotes

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 • • 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

Thumbnail
gallery
0 Upvotes