Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quarkiverse/quarkus-fx
Run Java FX on Quarkus
https://github.com/quarkiverse/quarkus-fx
javafx quarkus quarkus-extension
Last synced: about 2 months ago
JSON representation
Run Java FX on Quarkus
- Host: GitHub
- URL: https://github.com/quarkiverse/quarkus-fx
- Owner: quarkiverse
- License: apache-2.0
- Created: 2024-01-27T01:34:07.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-04-13T15:13:19.000Z (8 months ago)
- Last Synced: 2024-04-13T16:32:51.379Z (8 months ago)
- Topics: javafx, quarkus, quarkus-extension
- Language: Java
- Homepage: https://openjfx.io/
- Size: 211 KB
- Stars: 18
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- AwesomeJavaFX - Quarkus-fx - An extension to run JavaFX in a Quarkus application. (Libraries, Tools and Projects)
README
# quarkus-fx
[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.fx/quarkus-fx-parent?logo=apache-maven&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.fx/quarkus-fx)
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
This Quarkus extension allows you to use JavaFX in your Quarkus application. \
It will allow component injection in FX Controllers and will allow you to use CDI events to register on primary stage creation.Please refer to documentation available at https://docs.quarkiverse.io/quarkus-fx/dev/index.html
You will be able to register on primary stage creation event via such code example.
```java
public class QuarkusFxApp {@Inject
FXMLLoader fxmlLoader;public void start(@Observes final FxPostStartupEvent event) {
try {
InputStream fxml = this.getClass().getResourceAsStream("/app.fxml");
Parent fxmlParent = this.fxmlLoader.load(fxml);Stage stage = event.getPrimaryStage();
Scene scene = new Scene(fxmlParent);
stage.setScene(scene);
stage.show();} catch (IOException e) {
// Handle error
}
}
}
```
To load multiple FXML files, you can use :
```java
@Inject
Instance fxmlLoader;
```Also, setting the location is required by some use cases (use of relative paths in FXML)
```java
FXMLLoader loader = this.fxmlLoader.get();
// Set location for relative path resolution
loader.setLocation(xxx);
```For some sample apps and usage, check the `samples/` directory.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Clément de Tastes
💻 🚧
Ghazy Abdallah
💻
Scott M Stark
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!