来自Java的Windows 10上的通知

IXT*_*nai 6 java windows notifications

我正在创建一个推送通知的Java程序,我想删除或编辑"Java(TM)Platform SE binary"这一行.

这可能吗?我在谷歌搜索但我看不到有关此信息.

这是相关的代码.最后一行是推送通知的行.

public void mostrarNotificacion(Usuario user) throws AWTException, java.net.MalformedURLException, IOException {
    //Obtain only one instance of the SystemTray object
    SystemTray tray = SystemTray.getSystemTray();

    //Get image
    BufferedImage trayIconImage = ImageIO.read(getClass().getResource("favicon.png"));
    int trayIconWidth = new TrayIcon(trayIconImage).getSize().width;
    TrayIcon trayIcon = new TrayIcon(trayIconImage.getScaledInstance(trayIconWidth, -1, Image.SCALE_SMOOTH));

    //Let the system resizes the image if needed
    trayIcon.setImageAutoSize(true);

    //Set tooltip text and notification text
    if(user.getDescargos()>=5 || user.getOtrosPendientes()>=1){
        mensaje = "Descargos pendientes: " + user.getDescargos() + "\nSecciones pendientes: "+ user.getOtrosPendientes();
    }
    trayIcon.setToolTip(mensaje);
    tray.add(trayIcon);
    trayIcon.displayMessage("Pendientes EKHI", mensaje, MessageType.WARNING);
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 1

如果您使用,则不会出现“Java(TM) Platform SE 二进制文件”TrayIcon.MessageType.NONE

示例图片:

在此输入图像描述