Created
September 22, 2021 01:54
-
-
Save dustinkredmond/e1e59786ab50537d6868feaf5238c58b to your computer and use it in GitHub Desktop.
Minimize window and allow FXTrayIcon to exist in system tray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import com.dustinredmond.fxtrayicon.FXTrayIcon; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.GridPane; | |
import javafx.stage.Stage; | |
public class App extends Application { | |
@Override | |
public void start(Stage stage) throws Exception { | |
FXTrayIcon icon = new FXTrayIcon(stage, getClass().getResource("image.png")); | |
icon.show(); | |
GridPane grid = new GridPane(); | |
Button button = new Button("Minimize Icon"); | |
button.setOnAction(e -> stage.hide()); | |
stage.setScene(new Scene(grid)); | |
stage.show(); | |
} | |
public static void main(String[] args) { | |
Application.launch(App.class, args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment