JavaFx2 实现系统托盘 (使用swing的方法)
package test.test2;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javax.imageio.ImageIO;
public class TrayDemo extends Application {
private TrayIcon trayIcon;
/**
* @param args
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
enableTray(stage);
GridPane grid &