Posts

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…

Registration Form Example Using JavaFX

Image
This is a simplest form for JavaFX registration layout, you can modify it whatever based on your need.

import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class App extends Application { private StackPane root = new StackPane(); private Stage stage; @Override public void init() { Button button = new Button("OPEN"); VBox vBox = new VBox(); vBox.setSpacing(8); vBox.setPadding(new Insets(10,10,10,10)); vBox.getChildren().addAll( new Label("Your Name"), new TextField(), new Label("Your Username"), new TextField(), new Label(&…

JavaFX Login Example Codes

Image
This is example of a login form created using JavaFX

import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class App extends Application { private StackPane root = new StackPane(); private Stage stage; @Override public void init() { Button button = new Button("OPEN"); VBox vBox = new VBox(); vBox.setSpacing(8); vBox.setPadding(new Insets(10,10,10,10)); vBox.getChildren().addAll( new Label("Your Username"), new TextField(), new Label("Your Password"), new PasswordField(), new Button("LOGIN")); root.getChi…

Windows 10 Connect

Image
Window 10 Connect is a windows program to help you work with other device, usually smartphone, so you can do like for example transferring file, etc.

To open Windows connect, you can do it by pressing window key, then type "Connect" to find the program, the other way is to click on Open center located on bottom right of your screen, after it's opened, at the bottom tiles, you click the connect tile.

Now your computer is ready for you to connect wirelessly.

JavaFX Load Local HTML File Using WebView

Image
JavaFX is platform to create GUI for desktop application in Java, it has more modern and performance than any other framework for desktop application development. It also support template using FXML and styling using CSS.

You can load an HTML file into JavaFX application using WebView, either it's available online, internet connection required or a local HTML resource, support CSS and Javascript. To load an HTML we can use WebView for example:
1. First create an html and put it on /src/main/resources/helloWorld.html
<html lang="en"> <head><title>Hello World</title></head> <body><h1>Hello world!</h1></body> </html>
2. Now for just demo, create a class name HelloWorldApplication.java that contains main method.
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class HelloWorldApplication extends App…