Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notifications on Windows 10 from Java

I'm creating a Java program which pushes notifications and I want to remove or edit the line which says "Java(TM) Platform SE binary".

Is this possible? I searched on google but I couldn't see info about this.

Here is the related code. The last line is the line that pushes the notification.

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);
}

enter image description here

like image 762
IXTR Unai Avatar asked Jul 21 '17 08:07

IXTR Unai


People also ask

How do I get notifications for Windows 10?

Manage notifications Windows 10: Select Start > Settings > System > Notifications & actions. Manage notifications MacOS: Select Apple menu > System Preferences > Notifications. Manage notifications Android: Select your phone's Settings app > Apps & Notifications>

How do I set custom notifications in Windows 10?

To get started, head to Settings > System > Notifications & actions‌ – or, if you're on a Windows 10 PC, click here to open notifications & actions. First, send notifications, reminders and alarms directly to the action center by right-clicking action center in your taskbar, then selecting Turn on quiet hours.


1 Answers

"Java(TM) Platform SE binary" doesn't appear if you use TrayIcon.MessageType.NONE

Example Image:

enter image description here

like image 125
AUPMA Avatar answered Sep 22 '22 15:09

AUPMA