Posts

Showing posts from August, 2019

JavaFX Dialog Material Design

Image
Jfoenix is a library to build JavaFX application using Material design principal. One of my favorite library and always use it whenever i program desktop application. You can get the library from this official website www.jfoenix.com, read the documentation for further use, or just put this to your Maven pom.xml :

<dependency>
    <groupId>com.jfoenix</groupId>
    <artifactId>jfoenix</artifactId>
    <version>8.0.9</version>
</dependency>


And this is about showing dialog in JavaFX, it has modern look with shadowing and animation when it showing and closing. This is full example on how to create a dialog with Jfoenix JfxDialog:
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXDialog; import com.jfoenix.controls.JFXDialogLayout; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layou…

JavaFX Alert Dialog Example With Pictures

Image
JavaFX has 5 different alert types, each have their own different icon button, and functionality. You can specify an alert based on what your application need. For example if you want to have and alert to indicate user input error, you can then use an alert then specifying the alert type with  Alert.AlertType.ERROR.

And  these are 5 different types of JavaFX alert dialog:

1. Error Alert - usually to indicate an error

Alert alert = new Alert(Alert.AlertType.ERROR); alert.setContentText("Alert Message"); alert.show();
2. Info Alert - usually use for information

Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setContentText("Alert Message"); alert.show();
3. Confirmation Alert

Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setContentText("Alert Message"); alert.show();
4. Warning Alert

Alert alert = new Alert(Alert.AlertType.WARNING); alert.setContentText("Alert Message"); alert.show();
5. Empty Alert - an empty alert you can c…

JavaFX Combo Box with Search Autocomplete

Image
JavaFX is a java framework for building cross-platform desktop application under the Java Platform, i have been doing JavaFX programming for the last couples of months and been feel really happy.

It's good practice to build a desktop application UI, instead of web-based UI, i mean, and the thing that it's under Java, it has lot of supporting tools and libraries. Yeah Java has been sucks on the UI, even me as I've been doing web for years, i feel really frustrated doing UI programming for the first time in Java.

It is hard to find for example a library to support a combo box with search functionality, you can find it a lot's of lots library in Javascript, but Java, i'd say none, i should implement it myself, and it's been really difficult as i don't think i have enough experiences in JavaFX.

So here's a simple implementation of JavaFX combo box with search autocomplete. Create a class name it AutoCompleteBox.java:
import javafx.application.Platform; impor…