A library for JavaFX that gives you the ability to show progress on the Windows taskbar.

Overview

JavaFXTaskbarProgressbar

A clean and easy way to implement this amazing native Windows taskbar-progressbar functionality in javaFX

Background

Since Windows 7 there is a taskbar-progressbar feature in Windows systems that basically means that you can see progress on the program's taskbar icon. A good example for this when you copy something using the file explorer:
Taskbar progressbar in windows 7
This is very useful because you don't have to open the window to see the progress! The problem is that javaFX doesn't provide this functionality by default... however you can easily implement it with this library!

Compatibility

This library has support for java 8 and java 11 too.
The 'v11.x' versions are for java11 users and the 'v8.x' versions are for java 8 users.

Using with java 11

If you use java 11 you have to pass this VM argument: --add-exports javafx.graphics/com.sun.glass.ui=nativejavafx.taskbar. Also, you have to mention the nativejavafx.taskbar module in your module-info.java file:

module YourModule {
    ...
    requires nativejavafx.taskbar;
}

How to include it to your project

Maven example:

Add JitPack.io to your repositories :

<repositories>
   <repository>
     <id>jitpack.io</id>
     <url>https://jitpack.io</url>
   </repository>
</repositories>

Add the dependency:

<dependency>
	<groupId>com.github.Dansoftowner</groupId>
	<artifactId>FXTaskbarProgressBar</artifactId>
	<version>v11.4</version>
</dependency>

Gradle example

Add the repository:

repositories {
    //...
    maven { url 'https://jitpack.io' }
}

Add the dependency:

dependencies {
    //...
    implementation 'com.github.Dansoftowner:FXTaskbarProgressBar:v11.4'
}

How to use it Tutorial

0. Types of progressbar

Before we jump in, we have to know the 4 types of a taskbar-progressbar:

  • NORMAL - a progressbar with normal green color
  • PAUSED - a progressbar with a yellow color
  • ERROR - a progressbar with a red color
  • INDETERMINATE - a progressbar that doesn't show any fix progress
  • NO_PROGRESS - a progressbar that doesn't show anything

    All these types are represented by the enum called com.nativejavafx.taskbar.TaskbarProgressbar.Type.

Now let's see how can we actually use this through code.
There are multiple ways to create taskbar progressbars with this library:

1.Through static methods:

Firstly you have to import the necessary class:

import com.nativejavafx.taskbar.TaskbarProgressbar; 

...and you have to show the javafx Stage before any operation:

primaryStage.show();

Then call the static method:

TaskbarProgressbar.showCustomProgress(primaryStage, 0.5, TaskbarProgressbar.Type.NORMAL);

Well, the code above looks okay, but it's not safe. This functionality isn't supported by every OS. For example on a Linux system it will definitely throw an UnsupportedSystemException because it's only available on Windows 7+ systems.
If you use static methods to create taskbar-progressbars you always have to check that the current OS supports this functionality!

So let's correct the code:

if (TaskbarProgressbar.isSupported()) {
    TaskbarProgressbar.showCustomProgress(primaryStage, 0.5, TaskbarProgressbar.Type.NORMAL);
}

...now it is safe!

Result:
Normal Taskbar progressbar

You have to do a similar thing if you want to show an indeterminate progress:

if (TaskbarProgressbar.isSupported()) {
    TaskbarProgressbar.showIndeterminateProgress(primaryStage);
}

Result:
Indeterminate Taskbar progressbar

To stop the progress:

TaskbarProgressbar.stopProgress(primaryStage);

2. Through instantiation (the recommended way)

Firstly (after you imported the necessary class) create a TaskbarProgressbar instance with the help of TaskbarProgressbarFactory:

TaskbarProgressbar progressbar = TaskbarProgressbarFactory.getTaskbarProgressbar(primaryStage);

Before any operation you have to show the Stage:

primaryStage.show();

After that just use the created instance for the operations:

progressbar.showCustomProgress(0.5, TaskbarProgressbar.Type.NORMAL);

Note: in this case to check that the OS supports this functionality is unnecessary because the object checks it automatically!

The result is the same:
Normal Taskbar progressbar

If you want an indeterminate process:

progressbar.showIndeterminateProgress();

To stop the progress:

progressbar.stopProgress();

Bonus features

A simple method for showing a fully loaded error progressbar

progressbar.showFullErrorProgress();
//equivalent to progressbar.showCustomProgress(100, 100, TaskbarProgressbar.Type.ERROR) 

Result:
Full errror taskbar progress

Also:

progressbar.showFullNormalProgress();
progressbar.showFullPausedProgress();

More screenshots

Some more screenshots about what can you do with this library

  • A paused progress example:
    Code: progressbar.showCustomProgress(0.7, TaskbarProgressbar.Type.PAUSED);
    Paused progress
  • An error progress example:
    Code: progressbar.showCustomProgress(0.4, TaskbarProgressbar.Type.ERROR);
    Paused progress

Full demo

A full demo-example class is available here.

Projects using FXTaskbarProgressBar

If this library is used by your project, let me know in the Discussions and I will mention that in this section.

Source code

This project has two important branches:

  • "master" - for java 8 builds
  • "11" - for java 11 builds

Used libraries

Support

If you like this library give it a star!

Issues
  • Java 11 - StageHelper.getStage() not exits

    Java 11 - StageHelper.getStage() not exits

    Good morning, you made a great project to use the progress of windows. Thank you.

    I would like to report a bug in the Java 11 version, the StageHelper class does not exit getStage() function, has been removed.

    You can work around this using the static classes, because the use of the windows class is implemented.

    TaskbarProgressbar.showIndeterminateProgress (0);

    opened by JhonnySalles 4
  • Module-Info

    Module-Info

    Thanks for all the updates on your project, i am very grateful.

    I tried to migrate to use your project by maven, but it presents conflicts when used by modules, due to not being able to obtain the specific name, so I returned to using your jar in the Referenced Libraries.

    By default, when you don't have the module configuration file in your projects, java tends to use the name of the project or class, but I couldn't find the correct name for it to work with the module configuration.

    If possible, I would like you to add Module-Info in your project, as this way I can configure the module correctly through the name given in this file.

    image

    image

    opened by JhonnySalles 2
  • Compiling error with Java 8

    Compiling error with Java 8

    Hi. I use your library in my project with Java 8.

    And I get error:

    Error:(8, 32) java: cannot access com.nativejavafx.taskbar.TaskbarProgressbar
      bad class file: /C:/Users/Tsyklop/.m2/repository/com/github/Dansoftowner/FXTaskbarProgressBar/11.2.7/FXTaskbarProgressBar-11.2.7.jar!/com/nativejavafx/taskbar/TaskbarProgressbar.class
        class file has wrong version 55.0, should be 52.0
        Please remove or make sure it appears in the correct subdirectory of the classpath.
    

    README tell about that library use for Java 8 and above. But something went wrong

    opened by Tsyklop 1
  • [Suggestion] [Java 8] method isActive return boolean

    [Suggestion] [Java 8] method isActive return boolean

    Hi!

    I want to make a suggestion, can you do a method "isActive" which return a boolean true or false, so we can detect if a TaskbarProgressBar is active or not so we can access it anywhere!

    Cordially, NzoSifou

    enhancement 
    opened by NzoSifou 1
  • Support binding

    Support binding

    Something like taskbarProgressbar.progressProperty().bind(x.xxxProperty())

    enhancement 
    opened by Dansoftowner 0
  • JUnit starting error

    JUnit starting error

    I want to start junit tests. But I cant.

    I got error: image

    I I remove FXTaskbarProgressBar dependency - all fine.

    I have simple test:

    package info.test;
    
    import org.junit.jupiter.api.Test;
    
    public class JUnitTest {
    
        @Test
        public void test() {
    
        }
    
    }
    
    

    I have next pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>org.example</groupId>
        <artifactId>junit-test</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
    
            <java.version>1.8</java.version>
    
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.source>1.8</maven.compiler.source>
    
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            
            <slf4j.version>1.7.30</slf4j.version>
    
            <lombok.version>1.18.6</lombok.version>
    
            <logback.version>1.2.3</logback.version>
    
            <commons-io.version>2.6</commons-io.version>
    
            <commons-text.version>1.9</commons-text.version>
    
            <commons-lang3.version>3.11</commons-lang3.version>
    
            <commons-codec.version>1.14</commons-codec.version>
    
            <commons-validator.version>1.7</commons-validator.version>
    
            <commons-beanutils.version>1.9.4</commons-beanutils.version>
    
            <commons-collections4.version>4.4</commons-collections4.version>
    
            <commons-configuration2.version>2.7</commons-configuration2.version>
    
            <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    
            <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
    
            <reflections.version>0.9.12</reflections.version>
    
            <FXTaskbarProgressBar.version>v8.2</FXTaskbarProgressBar.version>
    
            <jackson-core.version>2.10.1</jackson-core.version>
            <jackson-databind.version>2.10.1</jackson-databind.version>
            <jackson-datatype-jdk8.version>2.10.1</jackson-datatype-jdk8.version>
            <jackson-datatype-jsr310.version>2.10.1</jackson-datatype-jsr310.version>
            <jackson-module-parameter-names.version>2.10.1</jackson-module-parameter-names.version>
    
            <mockito.version>3.9.0</mockito.version>
    
            <junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
            <junit.platform.version>1.8.0-M1</junit.platform.version>
    
        </properties>
    
        <dependencies>
    
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
    
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
    
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
    
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-text</artifactId>
                <version>${commons-text.version}</version>
            </dependency>
    
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>
    
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>${commons-beanutils.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-collections</groupId>
                        <artifactId>commons-collections</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>commons-validator</groupId>
                <artifactId>commons-validator</artifactId>
                <version>${commons-validator.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-collections</groupId>
                        <artifactId>commons-collections</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${commons-collections4.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-configuration2</artifactId>
                <version>${commons-configuration2.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.commons</groupId>
                        <artifactId>commons-text</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.commons</groupId>
                        <artifactId>commons-lang3</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>org.reflections</groupId>
                <artifactId>reflections</artifactId>
                <version>${reflections.version}</version>
            </dependency>
    
            <!-- JSON -->
    
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson-core.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-parameter-names</artifactId>
                <version>${jackson-module-parameter-names.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jdk8</artifactId>
                <version>${jackson-datatype-jdk8.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jsr310</artifactId>
                <version>${jackson-datatype-jsr310.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.github.Dansoftowner</groupId>
                <artifactId>FXTaskbarProgressBar</artifactId>
                <version>${FXTaskbarProgressBar.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${junit.jupiter.version}</version>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>org.junit.platform</groupId>
                <artifactId>junit-platform-runner</artifactId>
                <version>${junit.platform.version}</version>
                <scope>test</scope>
            </dependency>
    
        </dependencies>
    
        <repositories>
            <repository>
                <id>jitpack.io</id>
                <url>https://jitpack.io</url>
            </repository>
        </repositories>
    
    </project>
    
    invalid 
    opened by Tsyklop 0
Releases(v8.4)
Owner
Daniel Gyoerffy
A JVM lover.
Daniel Gyoerffy
A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

ChartFx ChartFx is a scientific charting library developed at GSI for FAIR with focus on performance optimised real-time data visualisation at 25 Hz u

GSI CS-CO/ACO 250 Apr 24, 2021
📊 Exposing charts from Java to JavaFX and the Web!

Exposing charts from Java to JavaFX and to the Web! JavaFX · Charts · Websockets · Jetty · Web JavaFxDataviewer is an open-source data visualization t

jasrodis 56 Oct 27, 2020
Simple and clean testing for JavaFX.

TestFX Simple and clean testing for JavaFX. TestFX requires a minimum Java version of 8 (1.8). Documentation See the Javadocs for latest master. See t

null 698 Mar 12, 2021
Reactive JavaFX Event Handling

ReactorFX This lightweight convenience library allows for simple integration between Project Reactor and JavaFX. ReactorFX provides fluent factories t

Jake 18 Nov 10, 2020
Full Featured Google Chrome Dev Tools to JavaFX WebView browser debugging.

JavaFX WebView Debugger Via WebSocket connection to Google Chrome Dev Tools JavaFx WebView debugging with Chrome Dev tools is highly dependent on Goog

Vladimir Schneider 45 Jan 29, 2021
RxJava bindings for JavaFX

RxJavaFX: JavaFX bindings for RxJava Read the free eBook Learning RxJava with JavaFX to get started. RxJavaFX is a lightweight library to convert Java

ReactiveX 488 Mar 9, 2021
Provides a Java API to use the JavaScript library d3.js with the JavaFx WebView

javafx-d3 Provides a Java API for using the JavaScript library d3.js with JavaFx Applications. Many thanks to the authors of the projects gwt-d3 [1] a

null 90 Feb 13, 2021
图形化漏洞利用Demo-JavaFX版

更新 V1.1 参考冰蝎的代理,添加代理设置,方便走burp调试 优化批量检查逻辑,使用接口,这样每次添加新的漏洞利用时,就不需要修改批量检查的逻辑。 0x01 这是个嘛? 这是一个构建图形化漏洞利用的一个项目,已经写好架子,只需要往里填充exp即可,帮助安全人员快速构建一个图形化的、跨平台的漏洞利

yhy 56 Apr 7, 2021
BootstrapFX: Bootstrap for JavaFX

BootstrapFX BootstrapFX is a partial port of Twitter Bootstrap for JavaFX. It mainly provides a CSS stylesheet that closely resembles the original whi

Kordamp 589 Mar 13, 2021
Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile Intention Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE and provides the functionalities to use and handle easily Tile

Peter Rogge 11 Jun 8, 2020
Functional Reactive Programming (FRP) for JavaFX

ReduxFX Functional Reactive Programming (FRP) for JavaFX ReduxFX in 1 minute ReduxFX is a set of libraries that enable you to use functional reactive

Michael Heinrichs 104 Feb 28, 2021
Reactive event streams, observable values and more for JavaFX.

ReactFX ReactFX is an exploration of (functional) reactive programming techniques for JavaFX. These techniques usually result in more concise code, le

Tomas Mikula 336 Mar 8, 2021
Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.

FXTrayIcon Library intended for use in JavaFX applications that makes adding a System Tray icon easier. The FXTrayIcon class handles all the messy AWT

Dustin Redmond 87 Mar 11, 2021
💠 Undecorated JavaFX Scene with implemented move, resize, minimise, maximise, close and Windows Aero Snap controls.

Support me joining PI Network app with invitation code AlexKent FX-BorderlessScene ( Library ) ?? Undecorated JavaFX Scene with implemented move, resi

Alexander Kentros 109 Apr 8, 2021