Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 for the tray icon
- 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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement