trayicon

How to add ContextMenu to the system tray icon programmatically?

天涯浪子 提交于 2020-08-22 09:45:12
问题 I want to programmatically add a context menu to my tray icon, so that when I right-click on the tray icon, it should show me the menu.How should I write the right-click event handler for my tray icon? I have tried the below: private void Icon_MouseRightClick(object sender, MouseButtonEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) // shows error ate button { return; } if (e.Button == System.Windows.Forms.MouseButtons.Right) { // code for adding context menu } }

Adding JPopupMenu to the TrayIcon

吃可爱长大的小学妹 提交于 2020-01-21 02:54:05
问题 I want to add JPopupMenu to the task bar as a TrayIcon ( i.e systemTray.add(trayIcon) ) but I haven't found a way to do so.From the docs the constructor of TrayIcon looks like : public TrayIcon(Image image, String tooltip, PopupMenu popup) Is there any way I can do this ? 回答1: This is a known problem. There is a bug report, which contains the outline of a workaround. I've adapted that below: // Build your popup menu final JPopupMenu trayPopup = new JPopupMenu(); // I'm using actions, there

Tray button handles in Windows 10

北城余情 提交于 2020-01-16 08:48:31
问题 I have a project that I developed about seven years ago in Win95, and works in Win7. It is developed in Visual Studio 2005. This application looks for the "You have new email" tray icon that appears in the tray (in various forms) by most email applications. I use it to blink an LED on a serial port, so I can glance in the room to see if I have email, rather than going to the computer, moving the mouse to wake the screen, and looking at the tray or the email program itself. It's a time-saver

Can I differentiate between single and double clicks on the system tray icon?

十年热恋 提交于 2020-01-06 02:52:07
问题 I create my system tray icon using Shell_NotifyIcon and then trap its WM_LBUTTONDBLCLK notifications for when a user double-clicks the icon (I use it show a dialog window.) I also trap WM_RBUTTONDOWN notifications to show the context menu. Now I'm thinking that it would be nice to show a context menu after a single left click. But how do I do that? If I trap WM_LBUTTONDOWN and show my context menu it works fine. But then when someone double-clicks the icon, it first shows my context menu and

threading for tray icon application

拈花ヽ惹草 提交于 2020-01-02 09:13:22
问题 I want to have a tray icon to inform me whether or not my COM port is plugged-in. It should change every 5 seconds according to the state of the COM port. I also want the ability to kill the program using the contextual menu of the tray icon. I figured out how to have the refreshing or the menu, but I don't know how to have both. import sys import glob import serial import time from PyQt4 import QtGui, QtCore import sys import threading from multiprocessing import Process, Queue #script

Nicer notifications in tray

左心房为你撑大大i 提交于 2020-01-01 09:32:19
问题 Do you know any example with nicer notification in system tray? I don`t like standard baloon so maybe there are others free, third-party components I can use? Thanks 回答1: here is another example http://www.codeproject.com/KB/miscctrl/taskbarnotifier.aspx 回答2: As a designer, I think I know what you are looking for. You want an outlook like notification (as a mini dialog box), you can see an example here. Enjoy. 来源: https://stackoverflow.com/questions/1393928/nicer-notifications-in-tray

Creating tray icon using JavaFX

为君一笑 提交于 2020-01-01 04:43:29
问题 I want to write a tray icon via JavaFx , but I only find that can write by awt . Is there any way that can write it use JavaFx ? It will look like these tray icons from Windows 10: 回答1: If this is to be believed, JavaFX will feature tray icons in a future update. Till then stick to AWT. Keep track of the development using this thread on the JDK bug system. Hope this helps. 回答2: You can't with pure JavaFX, but you can use AWT with JavaFX: import javafx.application.*; import javafx.geometry.Pos

How do I get a PopupMenu to show up when I left-click on a TrayIcon in Java?

柔情痞子 提交于 2019-12-29 01:31:06
问题 Currently, the PopupMenu will show up when I right-click on the TrayIcon in the SystemTray. However, I want it to do the same when I left-click on the TrayIcon. I thought I might accomplish this by using a mouseListener on the TrayIcon, but I don't know what method to invoke in the mouseClicked event to achieve the desired results. icon = new TrayIcon(img, tooltip, popup); icon.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { popup.setEnabled(true); } }); Using

Large items in the notification area (AKA system tray)?

[亡魂溺海] 提交于 2019-12-24 04:40:22
问题 I would like to place some large items in the XP system tray. (the one next to the clock) By this i mean items that take up more than the standard icon space. I know it can be done because I have seen several weather and time applications with this functionality. For example http://www.respectsoft.com/weather-clock-screenshots.php (see the clock screen shots) But I cannot find any doco on how to do this. While .net code would be preferred instructions in other technologies would also be

Java TrayIcon message close button

萝らか妹 提交于 2019-12-23 13:13:40
问题 The real question here might be if there's a better way to display desktop messages in Java. However... I'm using the Java trayicon to display messages to a desktop user. Because they want to keep certain messages up until the user clicks on them, in order to use the 'displayMessage' feature, I have to keep displaying them until the user clicks on them and I get an action command. However, if the user clicks on the little close button, I don't get an action command. I'm developing this on