apache / apache/netbeans

JavaFX application with Gluon SceneBuilder

Open
#4,812 0 comments 0 reactions 0 assignees View on GitHub
JavaFX kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 15

### What happened

NetBeans failed to produce a build when following a tutorial example to create a simple javafx application using SceneBuilder to construct the FXML file.
The FXMLController class was unable to detect an instance of the components defined within the FXML file.

The problem appears to have 3 contributors.
1. Within the FXMain class of the example the FXMLLoader was a static class object.
2. FXML.fxml resides in package directory.
3. SceneBuilder produces component identities by prefacing with id= e.g. id=label1.

The solution was to:
1. Create an instance of FXMLoader within FXMain.

3. Modify instances of id= to fx:id=
4. Copy FXML.fxml to class directory (/build/classes/

[FXMain .java.txt](https://github.com/apache/netbeans/files/9811859/FXMain.java.txt)
[FXML.fxml.txt](https://github.com/apache/netbeans/files/9811880/FXML.fxml.txt)
[FXMLController.java.txt](https://github.com/apache/netbeans/files/9811887/FXMLController.java.txt)

### How to reproduce

As described above.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Ubuntu 20.04.1 LTS(Jammy JellyFish)64-bit;Kernel Linux 15.5.0-50 generic x86_64; MATE 1.26.0

### JDK

java version "19" 2022-09-20 Java(TM) SE Runtime Environment (build 19+36-2238) Java HotSpot(TM) 64-Bit Server VM (build 19+36-2238, mixed mode, sharing)

### Apache NetBeans packaging

Apache NetBeans platform

### Anything else

_No response_

### Are you willing to submit a pull request?

Yes

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the attached FXMain.java, FXML.fxml, and FXMLController.java files, then reproduce the reported JavaFX application build and FXML injection behavior in Apache NetBeans 15. Determine whether the behavior is caused by NetBeans or by the example's FXMLLoader, resource location, and component identifiers; done means a confirmed, reproducible NetBeans issue with a scoped fix or clear closure rationale.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.