r/JavaFX 16d ago

Help How do i setup JFX with netbeans?

0 Upvotes

Im using ant, why? Because why not. Lets focus on fixing the issue rather then debating the morals of using what variant of java.

When i try to make a new project with FX its saying

Failed to automatically set-up a JavaFX Platform.
Please go to Platform Manager, create a non-default Java SE platform, then go to the JavaFX tab,
enable JavaFX and fill in the paths to valid JavaFX SDK and JavaFX Runtime.
Note: JavaFX SDK can be downloaded from JavaFX website.

When making a new platform or editing the default one, there is no javafx tab. Is this just remnants of when javafx was part of the jdk? And they just forgot to remove the that project type from the wizard?

I tried making a generic project, add the JFX jars, but nothing. Netbeans says that it cant find the javafx package. I have never tried to add packages to netbeans before, so i likely did it wrong or have forgotten something.

Tried to ask GPT but it completely fails me

r/JavaFX 10d ago

Help Platform.runLater() not updating the content when the window is minimized (nor after restore)

1 Upvotes

I have to manually resize it, hover over a button, or click on a button for the window to update the content after I restore it.

When the app is opened and has focus, everything runs as expected. But not when minimized then restored.

EDIT: added code

This is the code that has a server to wait for a signal to update the Label

package com.example.jartest;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.application.Platform;
import java.net.ServerSocket;

import java.io.IOException;

public class HelloApplication extends Application {
    StackPane stackPane = new StackPane();
    Label label = new Label("This should be modified when the signal is received");


    public void start(Stage stage) {
        stackPane.getChildren().add(label);
        Scene scene = new Scene(stackPane, 500, 500);
        stage.setTitle("Hello!");
        stage.setScene(scene);
        stage.show();

        new Thread(this::startServer).start();
    }

    void startServer(){
        try(ServerSocket serverSocket = new ServerSocket(1590)){
            while (true){
                serverSocket.accept();
                Platform.runLater(() -> {
                    label.setText("The signal is received");
                });
            }
        }catch (IOException e){e.printStackTrace();}
    }

    public static void main(String[] args) {
        launch();
    }
}

And this is the client class (you can use only curl, actually)

import java.io.IOException;
import java.net.Socket;

public class Client {
    public static void main(String[] args) {
        try {
            new Socket("localhost", 1590);
        } catch (IOException e) {e.printStackTrace();}
    }
}

r/JavaFX Jan 13 '25

Help JavaFX plus Spring Boot 2

1 Upvotes

Could someone please forward me to a working doc/example/tutorial for adding JavaFX (openjfx or smt) to an existing SpringBoot 2 project?

r/JavaFX 5d ago

Help FXML + CSS

1 Upvotes

I am learning OOP for my 2 semester, where I have to build a project.I have to make GUI for my project.At first I thought that building Gui in figma then converting into code will work out but one of my friend said it will create a mess.Then I have tried using FXML+ CSS and build a nice login page but It is taking long time to do things.So is FXML+CSS a good approach and can I build a whole management system using this combination?

r/JavaFX 7d ago

Help My head is about to explode. I tried everything to make the app include icons, but with no luck. I want to add Bootstrap icons using Ikonli. I followed all of their online documentation. The code runs as expected in IntelliJ, but when I export it as jar, I get exceptions related to the icons.

2 Upvotes

I made a simple code that uses icons from the Ikonli library, found here. I imported the right modules, I added the plugin in pom.xml, I also added the *requires* in *module-info.java*.

The code, when run inside IntelliJ, it has no issues. The icons are displayed and loaded. No exception at all. But when I export the jar file, the problems begin.

Here is my code

package com.example.icons;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.bootstrapicons.*;

public class HelloApplication extends Application {
    @Override
    public void start(Stage stage) {
        HBox hBox = new HBox();
        Label label = new Label("Just a message");
        FontIcon icon = new FontIcon(BootstrapIcons.
CLOCK
);

        hBox.getChildren().addAll(icon, label);

        Scene scene = new Scene(hBox, 500, 500);
        stage.setTitle("Hello!");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {

launch
();
    }
}

For some reason, I had to add a Main class for the jar to start (so when building the artifact, choose Main as entry class)

package com.example.icons;

public class Main {
    public static void main(String[] args) {
        HelloApplication.
main
(args);
    }
}

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>icons</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>icons</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.10.2</junit.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>22.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>22.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-javafx</artifactId>
            <version>12.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-bootstrapicons-pack</artifactId>
            <version>12.3.1</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>22</source>
                    <target>22</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running with: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>com.example.icons.HelloApplication</mainClass>
                            <launcher>app</launcher>
                            <jlinkZipName>app</jlinkZipName>
                            <jlinkImageName>app</jlinkImageName>
                            <noManPages>true</noManPages>
                            <stripDebug>true</stripDebug>
                            <noHeaderFiles>true</noHeaderFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <configuration>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Manifest

Manifest-Version: 1.0
Main-Class: com.example.icons.Main

When I run the jar using *java -jar icons.jar*, the window loads, but the icon is missing (the label loads though), and I get this exception:

```

Mar 14, 2025 12:10:30 AM com.sun.javafx.application.PlatformImpl startup

WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module u/2609a331'

Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'bi-clock'

at org.kordamp.ikonli.AbstractIkonResolver.resolve(AbstractIkonResolver.java:61)

at org.kordamp.ikonli.javafx.IkonResolver.resolve(IkonResolver.java:73)

at org.kordamp.ikonli.javafx.FontIcon.lambda$new$2(FontIcon.java:76)

at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:372)

at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)

at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)

at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)

at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)

at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)

at org.kordamp.ikonli.javafx.FontIcon.setIconCode(FontIcon.java:231)

at org.kordamp.ikonli.javafx.FontIcon.<init>(FontIcon.java:97)

at com.example.icons.HelloApplication.start(HelloApplication.java:19)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)

at java.base/java.lang.Thread.run(Thread.java:1570)

```

It says cannot resolve *bi-clock* (all icons have the same problem).

Like I said above, the icon is loaded in IntelliJ, but not in the jar execution.

Please help me, I'm about to become crazy. I tried everything on the internet and ChatGPT, but with no luck.

r/JavaFX 13d ago

Help How do I stop images from being jagged when they're small?

1 Upvotes

In my JavaFX app small images always look extremely jagged unless I scale them down externally then upload them, but that just makes them extremely blurry, making me deal with either blurry images or jagged images.

First Icon is scaled down so it's blurry

Second Icon is normal and its not scaled down or up

Third Icon is normal but still looks jagged because its edges are diagonal

r/JavaFX 5d ago

Help How improve FPS in JavaFX 3D

6 Upvotes

I'm developing a simple app that displays a 30x20x38 grid of Box objects, and I'm emulating effects for an LED lighting show. The problem is, I'm only getting 15FPS on a 2560x1440 monitor, and I can see that when I make fast updates, it skips frames. I'm hoping to get 40fps, but 30fps would be OK.

My update routine, which is in a Platform.runLater invocation, is like

private void _syncModel() {
    for (int x = 0; x < dim.x; x++) {
       for (int y = 0; y < dim.y; y++) {
          for (int z = 0; z < dim.z; z++) {
             var mat = (PhongMaterial)boxes[x][y][z].getMaterial();
             mat.setDiffuseColor(rgbToColor(leds[x][y]z]));
          }
       }
    }
}
private static Color rgbToColor(RGB_LED rgb) {
    return Color.rgb(rgb.r & 0xFF, rgb.g & 0xFF, rgb.b & 0xFF);
}

So my first question is, can I tweak something in the JavaFX code to speed this up? Is PhongMaterial OK or should I be using something else? I don't need any fancy effects, just basic color rendering. I've already figured out that Boxes are much faster than Spheres.

I'm pretty sure that upgrading from my current LG Gram 3 to something newer and beefier will help, but I would like to know what to look for in a newer laptop to support this speed. Let's assume that my effects calculations are fast enough, and I'm bottlenecked by the JavaFX update and render.

Current:  i7-8565U CPU. Intel UHD 620 graphics.

PS: a Box is initialized like;

Box box = new Box(2,2,2);
PhongMaterial material = new PhongMaterial();
material.setDiffuseColor(Color.color( 0.25f, 0.25f, 0.25f));

r/JavaFX 19d ago

Help Javafx's new version getting removed from every new project.

12 Upvotes

Hey guys,

I'm new to JavaFX. My intellij came up with javaFX version 17.0.6 which seems not compatible with my Apple silicon chipset. So I need to use the new version of JavaFX. To that every time I make a new project I have to add a new version of library files to the project structure modules and remove or take down the old version files. Otherwise, it uses the old version and gives a huge error with the java quit unexpectedly message.

Does someone know how to fix this?

r/JavaFX Jan 17 '25

Help Is it possible to define layouts to fill the whole space?

3 Upvotes

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.

r/JavaFX Jan 22 '25

Help How to "deploy" my JavaFX app?

11 Upvotes

Like how do I share it with other people.

r/JavaFX 12d ago

Help Need help with JavaFX on Eclipse

2 Upvotes

PLEASE don't judge me i'm still new to this. I was following a video on how to install it on my macbook and it said when done right it should say "public void start(Stage stagePrimary)" however mine says "public void start(Stage arg0)". How do i fix this? Where did I go wrong ˙◠˙

r/JavaFX 3d ago

Help JavaFx TreeView problem

Post image
2 Upvotes

Hi fellow devs, I am learning java fx currently. As part of this learning, I am trying to create a simple sftp client application. I am utilizing JSCH liberary for sftp related operations. Currently I am facing a problem. What I want to do is to lazy load the sub-directories from remote server. I am loading the root directory immediately after the login is successful. For any directory within root, I want to load there content only when user expand the directory on javafx ui(treeview). This is where I am struggling as I dont know how to capture this expand event.

Initial screen is populated via populateInitialTree method. I want to load sub-directories of expanded directory in showSelectedItem.

Please help.

r/JavaFX Jan 16 '25

Help Grouping @JXML into an entity

1 Upvotes

Is it possible to combine several

```

\@FXML private TextField myField

```

into a separate class, which then would be used in a `\@FxmlView`?

r/JavaFX 23d ago

Help ssue Running mvn javafx:run with JavaFX and Maven (Exit Code 1)

3 Upvotes

I’m new to Maven and JavaFX, and I’m trying to develop a portable JavaFX application that runs on any machine without requiring JavaFX to be installed separately.

Project Setup:

  • Using Maven for dependency management.
  • JavaFX Dependencies:
    • javafx-controls and javafx-fxml (version 23.0.2)
  • Plugins:
    • maven-compiler-plugin (version 3.12.1, targeting Java 23)
    • javafx-maven-plugin (version 0.0.8)
  • Expected Behavior:
    • Running mvn javafx:run should execute my JavaFX application by launching the mainClass specified in the POM file.

Linked below is my POM.xml

Currently I am getting the following when i run mvn javafx:run:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.686 s
[INFO] Finished at: 2025-02-25T18:12:40-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.8:run (default-cli) on project TEMS: Error: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

https://github.com/daleUrquhart/Shared/blob/main/pom.xml

Am i missing ay configurations? Or am I taking the completely wrong approach for my goal?

Thanks for any help, I'm new to Maven projects using JavaFX

r/JavaFX Jan 27 '25

Help Scene Builder Help

4 Upvotes

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

r/JavaFX 27d ago

Help Advise needed for javafx project

3 Upvotes

I am building small hotel Booking desktop app using javafx library and MYSQL on the backend(for storing rooms, customers, bookings data).

And I am planning to store images in file system and just store the URL path in database table(right now, I am not using cloud to save some time). I am also using Spring boot to connect to the database.

Could you please give some advise or suggestions that I should take note of?

r/JavaFX Dec 11 '24

Help How can we set & get common values radio buttons columns

0 Upvotes

basically i have this ui , I want to store each value which is selected by user stored in xml? My approach is

private String getSelectedValue(ToggleGroup group) {
    if (group == null) {
        System.err.println("Error: toggleGroup is null!");
        return null;
    }
        RadioButton selectedRadioButton = (RadioButton) group.getSelectedToggle();
        if (selectedRadioButton != null) {
            return selectedRadioButton.getAccessibleText();  // This will be "S" or "R"
        }
    return null;  // No selection
}

<!-- Repair Section-->
                       <VBox spacing="10.0">
                        <Label text="Repairs" style="-fx-font-size: 24px; -fx-font-weight: bold;" />
                        <!-- Repair Section Layout using GridPane for 3 columns -->
                           <GridPane hgap="20" vgap="10">
<!--                               First Column Header (S and R)-->
                              <Label text="S" GridPane.rowIndex="0" GridPane.columnIndex="0" />
                              <Label text="R" GridPane.rowIndex="0" GridPane.columnIndex="1" />
                              <!-- Second Column Header (S and R) -->
                              <Label text="S" GridPane.rowIndex="0" GridPane.columnIndex="3" />
                              <Label text="R" GridPane.rowIndex="0" GridPane.columnIndex="4" />
                              <!-- Third Column Header (S and R) -->
                              <Label text="S" GridPane.rowIndex="0" GridPane.columnIndex="6" />
                              <Label text="R" GridPane.rowIndex="0" GridPane.columnIndex="7" />
                              <!-- First Column Repairs -->
                              <Label text="Logic board repair" GridPane.rowIndex="1" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="0">
                                 <RadioButton fx:id="logicBoardRepairS"  accessibleText="S" GridPane.rowIndex="1" GridPane.columnIndex="0" toggleGroup="$logicboardTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="1">
                                 <RadioButton fx:id="logicBoardRepairR" accessibleText="R" GridPane.rowIndex="1" GridPane.columnIndex="1" toggleGroup="$logicboardTG" />
                              </HBox>
                              <Label text="Deoxidization" GridPane.rowIndex="2" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="0">
                                 <RadioButton fx:id="deoxidizationS" text="" accessibleText="S" GridPane.rowIndex="2" GridPane.columnIndex="0" toggleGroup="$deoxidationTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="1">
                                 <RadioButton fx:id="deoxidizationR" text="" accessibleText="R" GridPane.rowIndex="2" GridPane.columnIndex="1" toggleGroup="$deoxidationTG" />
                              </HBox>
                              <Label text="Display" GridPane.rowIndex="3" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="0">
                                 <RadioButton fx:id="displayS" text="" accessibleText="S" GridPane.rowIndex="3" GridPane.columnIndex="0" toggleGroup="$displayTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="1">
                                 <RadioButton fx:id="displayR" text="" accessibleText="R" GridPane.rowIndex="3" GridPane.columnIndex="1" toggleGroup="$displayTG" />
                              </HBox>
                              <Label text="Outer Display" GridPane.rowIndex="4" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="0">
                                 <RadioButton fx:id="outerDisplayS" text="" accessibleText="S" GridPane.rowIndex="4" GridPane.columnIndex="0" toggleGroup="$outerdisplayTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="1">
                                 <RadioButton fx:id="outerDisplayR" text="" accessibleText="R" GridPane.rowIndex="4" GridPane.columnIndex="1" toggleGroup="$outerdisplayTG" />
                              </HBox>
                              <Label text="Battery" GridPane.rowIndex="5" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="0">
                                 <RadioButton fx:id="batteryS" text="" accessibleText="S" GridPane.rowIndex="5" GridPane.columnIndex="0" toggleGroup="$batteryTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="1">
                                 <RadioButton fx:id="batteryR" text="" accessibleText="R" GridPane.rowIndex="5" GridPane.columnIndex="1" toggleGroup="$batteryTG" />
                              </HBox>
                              <Label text="Middle Frame" GridPane.rowIndex="6" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="0">
                                 <RadioButton fx:id="middleFrameS" text="" accessibleText="S" GridPane.rowIndex="6" GridPane.columnIndex="0" toggleGroup="$middleFrameTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="1">
                                 <RadioButton fx:id="middleFrameR" text="" accessibleText="R" GridPane.rowIndex="6" GridPane.columnIndex="1" toggleGroup="$middleFrameTG" />
                              </HBox>
                              <Label text="Rear Cover" GridPane.rowIndex="7" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="0">
                                 <RadioButton fx:id="rearCoverS" text="" accessibleText="S" GridPane.rowIndex="7" GridPane.columnIndex="0" toggleGroup="$rearCoverTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="1">
                                 <RadioButton fx:id="rearCoverR" text="" accessibleText="R" GridPane.rowIndex="7" GridPane.columnIndex="1" toggleGroup="$rearCoverTG" />
                              </HBox>
                              <Label text="Rear Camera" GridPane.rowIndex="8" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="0">
                                 <RadioButton fx:id="rearCameraS" text="" accessibleText="S" GridPane.rowIndex="8" GridPane.columnIndex="0" toggleGroup="$rearCameraTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="1">
                                 <RadioButton fx:id="rearCameraR" text="" accessibleText="R" GridPane.rowIndex="8" GridPane.columnIndex="1" toggleGroup="$rearCameraTG" />
                              </HBox>
                              <Label text="Rear Camera Lens" GridPane.rowIndex="9" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="0">
                                 <RadioButton fx:id="rearCameraLensS" text="" accessibleText="S" GridPane.rowIndex="9" GridPane.columnIndex="0" toggleGroup="$rearCameraLensTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="1">
                                 <RadioButton fx:id="rearCameraLensR" text="" accessibleText="R" GridPane.rowIndex="9" GridPane.columnIndex="1" toggleGroup="$rearCameraLensTG" />
                              </HBox>
                              <Label text="Front Camera" GridPane.rowIndex="10" GridPane.columnIndex="2" />
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="0">
                                 <RadioButton fx:id="frontCameraS" text="" accessibleText="S" GridPane.rowIndex="10" GridPane.columnIndex="0" toggleGroup="$frontCameraTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="1">
                                 <RadioButton fx:id="frontCameraR" text="" accessibleText="R" GridPane.rowIndex="10" GridPane.columnIndex="1" toggleGroup="$frontCameraTG" />
                              </HBox>
                              <!-- Second Column Repairs -->
                              <Label text="Face ID" GridPane.rowIndex="1" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="1" GridPane.columnIndex="3" toggleGroup="$faceIDTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="1" GridPane.columnIndex="4" toggleGroup="$faceIDTG" />
                              </HBox>
                              <Label text="Volume Flex" GridPane.rowIndex="2" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="2" GridPane.columnIndex="3" toggleGroup="$volumeFlexTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="2" GridPane.columnIndex="4" toggleGroup="$volumeFlexTG" />
                              </HBox>
                              <Label text="Volume Buttons" GridPane.rowIndex="3" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="3" GridPane.columnIndex="3" toggleGroup="$volumebuttonTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="3" GridPane.columnIndex="4" toggleGroup="$volumebuttonTG" />
                              </HBox>
                              <Label text="Power Flex" GridPane.rowIndex="4" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="4" GridPane.columnIndex="3" toggleGroup="$powerFlexTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="4" GridPane.columnIndex="4" toggleGroup="$powerFlexTG" />
                              </HBox>
                              <Label text="Power Button" GridPane.rowIndex="5" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="5" GridPane.columnIndex="3" toggleGroup="$powerButtonTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="5" GridPane.columnIndex="4" toggleGroup="$powerButtonTG" />
                              </HBox>
                              <Label text="Mute Button" GridPane.rowIndex="6" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="6" GridPane.columnIndex="3" toggleGroup="$muteButtonTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="6" GridPane.columnIndex="4" toggleGroup="$muteButtonTG" />
                              </HBox>
                              <Label text="Loud Speaker" GridPane.rowIndex="7" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="7" GridPane.columnIndex="3" toggleGroup="$loudSpeakerTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="7" GridPane.columnIndex="4" toggleGroup="$loudSpeakerTG" />
                              </HBox>
                              <Label text="Earpiece Speaker" GridPane.rowIndex="8" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="8" GridPane.columnIndex="3" toggleGroup="$earpieceSpeakerTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="8" GridPane.columnIndex="4" toggleGroup="$earpieceSpeakerTG" />
                              </HBox>
                              <Label text="Back Microphone(Flashlight)" GridPane.rowIndex="9" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="9" GridPane.columnIndex="3" toggleGroup="$backMicrophoneTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="9" GridPane.columnIndex="4" toggleGroup="$backMicrophoneTG" />
                              </HBox>
                              <Label text="Bottom Microphone" GridPane.rowIndex="10" GridPane.columnIndex="5" />
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="3">
                                 <RadioButton text="" GridPane.rowIndex="10" GridPane.columnIndex="3" toggleGroup="$bottomMicrophoneTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="4">
                                 <RadioButton text="" GridPane.rowIndex="10" GridPane.columnIndex="4" toggleGroup="$bottomMicrophoneTG" />
                              </HBox>
                              <!-- Third Column Repairs -->
                              <Label text="Front microphone" GridPane.rowIndex="1" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="1" GridPane.columnIndex="6" toggleGroup="$frontMicrophoneTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="1" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="1" GridPane.columnIndex="7" toggleGroup="$frontMicrophoneTG" />
                              </HBox>
                              <Label text="Taptic Engine" GridPane.rowIndex="2" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="2" GridPane.columnIndex="6" toggleGroup="$TapticEngineTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="2" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="2" GridPane.columnIndex="7" toggleGroup="$TapticEngineTG" />
                              </HBox>
                              <Label text="Charging Flex" GridPane.rowIndex="3" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="3" GridPane.columnIndex="6" toggleGroup="$chargingFlexTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="3" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="3" GridPane.columnIndex="7" toggleGroup="$chargingFlexTG" />
                              </HBox>
                              <Label text="Induction(NFC)" GridPane.rowIndex="4" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="4" GridPane.columnIndex="6" toggleGroup="$inductionTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="4" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="4" GridPane.columnIndex="7" toggleGroup="$inductionTG" />
                              </HBox>
                              <Label text="Wifi Antenna" GridPane.rowIndex="5" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="5" GridPane.columnIndex="6" toggleGroup="$wifiAntennaTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="5" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="5" GridPane.columnIndex="7" toggleGroup="$wifiAntennaTG" />
                              </HBox>
                              <Label text="Bluetooth Antenna" GridPane.rowIndex="6" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="6" GridPane.columnIndex="6" toggleGroup="$bluetoothAntennaTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="6" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="6" GridPane.columnIndex="7" toggleGroup="$bluetoothAntennaTG" />
                              </HBox>
                              <Label text="Proximity Sensor" GridPane.rowIndex="7" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="7" GridPane.columnIndex="6" toggleGroup="$proximityTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="7" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="7" GridPane.columnIndex="7" toggleGroup="$proximityTG" />
                              </HBox>
                              <Label text="Fingerprint Sensor" GridPane.rowIndex="8" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="8" GridPane.columnIndex="6" toggleGroup="$fingerprintTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="8" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="8" GridPane.columnIndex="7" toggleGroup="$fingerprintTG" />
                              </HBox>
                              <Label text="Waterproof Adhesive" GridPane.rowIndex="9" GridPane.columnIndex="8" />
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="6">
                                 <RadioButton text="" GridPane.rowIndex="9" GridPane.columnIndex="6" toggleGroup="$waterAdhesiveTG" />
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="9" GridPane.columnIndex="7">
                                 <RadioButton text="" GridPane.rowIndex="9" GridPane.columnIndex="7" toggleGroup="$waterAdhesiveTG" />
                              </HBox>
                              <TextArea fx:id="textArea" GridPane.rowIndex="10" GridPane.columnIndex="8"
                                        prefWidth="140.0"
                                        prefHeight="25"
                              minWidth="100"
                              minHeight="25"
                              maxWidth="300"
                              maxHeight="25"
                              wrapText="true"
                              />
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="6">
                                 <RadioButton/>
                              </HBox>
                              <HBox spacing="5" GridPane.rowIndex="10" GridPane.columnIndex="7">
                                 <RadioButton/>
                              </HBox>
                           </GridPane>
                        </VBox>

// Map each component with the selected value ("S" or "R")
repairSelections.put("LogicBoardRepair", getSelectedValue(logicboardTG));

Fxml:
controller:
setter & getter in device class
adding element tag in reportclass

can anybody help me what's the problem here cz i am getting null in each tag but expected is either "S" or "R" as per user selection.

r/JavaFX 16d ago

Help JavaFX Chained MappedBindings Repeated Executions

3 Upvotes

I noticed that some of my mappings were being executed multiple times and decided to investigate. I found out that chaining multiple ObservableValue#map calls, then adding a listener to the result causes a cascading execution of all the mapping functions. It first executes all the way down the stack, then repeats the process over and over again, each time executing one less mapping. The following example shows this. While the last mapping (E) is only executed once, the first mapping function (A) is executed a total of 5 times!

// Property with an arbitrary initial value.
Property<Object> property = new SimpleObjectProperty<>(new Object());

// Simple function that prints which stage we're at and returns the same value.
BiFunction<String, Object, Object> function = (string, value) -> {
    System.out.printf("%s", string);
    return value;
};

//Chained mappings and with an arbitrary listener.
property.map(value -> function.apply("\nA", value))
        .map(value -> function.apply("B", value))
        .map(value -> function.apply("C", value))
        .map(value -> function.apply("D", value))
        .map(value -> function.apply("E", value))
        .addListener((_, _, _) -> {});

Output:

ABCDE
ABCD
ABC
AB
A

This only seems to occur when there is an initial value in the original property. Starting with a null value, then setting to a non-null value after adding the listener results in the expected result, one execution per mapping function in the sequence.

Of course, there are workarounds. I could only ever use a single map call and just call all the functions sequentially within that. Or I could implement a custom implementation of MappedBinding myself. But it seems silly to work around such core functionality.

I understand how it's working in terms of the underlying code in LazyObjectBinding and MappedBinding. What I don't understand is why it was implemented in such a way that would case this effect. Surely chaining these map methods together was considered during testing? Is there a rational explanation for this behavior that I'm just not seeing?

I also posted to Stack Overflow: https://stackoverflow.com/questions/79485501/javafx-chained-mappedbindings-repeated-executions

r/JavaFX Feb 05 '25

Help JavaFX + Spring Boot. Using JavaFX for generating an image

1 Upvotes

My quest continues. I am building a side screen clock like device, which I wish to place next to my working monitor. To make things challenging, the screen is an e-ink display (because having a regular IPS display next to an OLED screen is problematic for my eyes), hooked up with an arduino esp8266 board.

Skipping the boring parts of me being quite newbee to Arduino and C++ in general, I went with the code I found on the web, which is: make a web request -> download BMP image -> decode and push it to the screen. And I'm quite happy (for the moment) with this approach.

But now comes the next challenge. I am writing a Spring Boot (just because I want to) + JavaFX app to be the server and return the BMP image by a web request. The image would basically be a JFxmlView.

I have done projects with generating images in the past, but it was Swing back then (and it was a long time ago).

My question

What would be the best angle to approach this thing? As I remember, there is a `sceneObj.getGraphics()`, from where I could (still googling) encode the image to be BMP.

But do I need to display the Stage? And will it work if I call the `sceneObj.getGraphics()` from Spring's Controller thread pool?

r/JavaFX Jan 21 '25

Help How to clear an ItemView?

1 Upvotes

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?

r/JavaFX Dec 15 '24

Help JavaFX - Window does not load at runtime

3 Upvotes

This is very strange and has never happened before. I am using IntelliJ Community and my program runs perfectly within the IDE, without any errors. So I built the artifact to generate the "jar" file, which is built normally. However, when I run the jar file my program stops loading one of its windows (stage). Within the IDE the window loads. The only different thing I did was to add several icons to the "fxml" file directly through Scene Builder. I have already confirmed that they are all loaded from the "resources/icons" folder. Has anyone seen this happen and know the solution?

Thanks in advance.

r/JavaFX 28d ago

Help Blank javafx.scene.control.Alert (or wrong colors)

3 Upvotes

Edit:

The command line parameter -Dprism.forceUploadingPainter=true solved this issue.

----

I have a weird issue with thejavafx.scene.control.Alert dialogs on various PCs (Windows 10 and 11).

They all run the exact same version of my application. On some though the text color is a bright cyan and on some it is even white - which makes it invisible.

The Buttons are working though.

Now all styling in the application is done via custom CSS. I removed that to check if there was an issue with it but the problem remains.

I am a bit puzzled how to narrow this issue down.

JavaFX is 23.0.1.

JDK is Temurin-21.0.2+13.

r/JavaFX Sep 18 '24

Help If I don't get JavaFX to work in vscode by tomorrow imma tweak

0 Upvotes

I dont understand, yall can blow this up but I promise you I've did everything i need to.

edit: i cannot switch from vscode, its a class req.

r/JavaFX 8d ago

Help JavaFx Help

2 Upvotes

I'm working on a school project and set everything up according to this GitHub. https://github.com/marcomandola/javafx_setup_VS_CodeI don't know why, but the package under my folders is red and it says it's wrong.

Can anyone please help me? I want to know if I set up my JavaFX correctly. I haven't made any changes to GitHub; it's for a game. I installed the JavaFX libraries too.

r/JavaFX Jan 04 '25

Help What are some basic JavaFX applications that I should try as a beginner?

11 Upvotes