Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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
Clément de Tastes

💻 🚧
Ghazy Abdallah
Ghazy Abdallah

💻
Scott M Stark
Scott M Stark

💻

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!