Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimize window and allow FXTrayIcon to exist in system tray
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