mirror of
https://github.com/Mibew/i18n.git
synced 2025-02-02 17:44:42 +03:00
add notifier project
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@731 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
fcb70074bf
commit
cb85159474
7
src/mibewjava/org.mibew.notifier/.classpath
Normal file
7
src/mibewjava/org.mibew.notifier/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.mibew.api"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
src/mibewjava/org.mibew.notifier/.project
Normal file
17
src/mibewjava/org.mibew.notifier/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.mibew.notifier</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,11 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
public class NotifyApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
TrayNotifier tn = new TrayNotifier();
|
||||
tn.init();
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Image;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.MenuShortcut;
|
||||
import java.awt.PopupMenu;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.net.URL;
|
||||
|
||||
public class TrayNotifier {
|
||||
|
||||
private TrayIcon trayIcon;
|
||||
|
||||
public TrayNotifier() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
if (SystemTray.isSupported()) {
|
||||
|
||||
SystemTray tray = SystemTray.getSystemTray();
|
||||
URL url = this.getClass().getResource("tray.png");
|
||||
Image image = Toolkit.getDefaultToolkit().getImage(url);
|
||||
|
||||
PopupMenu popup = new PopupMenu();
|
||||
MenuItem exitItem = new MenuItem("Exit", new MenuShortcut(KeyEvent.VK_X));
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
popup.add(exitItem);
|
||||
trayIcon = new TrayIcon(image, "Mibew Notifier", popup);
|
||||
trayIcon.setImageAutoSize(true);
|
||||
|
||||
try {
|
||||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
System.err.println("TrayIcon could not be added.");
|
||||
System.exit(1);
|
||||
}
|
||||
} else {
|
||||
System.err.println("TrayIcon could not be added.");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatus(boolean online) {
|
||||
}
|
||||
}
|
BIN
src/mibewjava/org.mibew.notifier/src/org/mibew/notifier/tray.png
Normal file
BIN
src/mibewjava/org.mibew.notifier/src/org/mibew/notifier/tray.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in New Issue
Block a user