public void run() {
// TODO Auto-generated method stub
super.run();
if (SystemTray.isSupported()) {
// get the SystemTray instance
tray = SystemTray.getSystemTray();
// load an image
String test = System.getProperty("user.dir").replace('\\', '/');
BufferedImage src = null;
try {
src = ImageIO.read(new File(test + "\\logo.jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 读入源图像
//
Image image = Toolkit.getDefaultToolkit().getImage(test + "\\logo.jpg");
// create a action listener to listen for default action executed on
// the tray icon
popup=new java.awt.PopupMenu();
mi1=new MenuItem("显示窗口");
mi2=new MenuItem("---");
popup.add(mi1);
popup.add(mi2);
mi1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
m.setVisible(true);
System.out.println("open");
}
});