package main;
import java.awt.AWTException;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import javax.swing.JOptionPane;
@SuppressWarnings("deprecation")
public class openDialog {
private static Thread serviceThread;
private static boolean pause = false;
private static TrayIcon tuopan;
private static Image image;
private static PopupMenu menu;
private static MenuItem startItem;
private static MenuItem stopItem;
private static JOptionPane o = new JOptionPane();
static{
//初始化托盘菜单
{
startItem = new MenuItem("start Service");
stopItem = new MenuItem("stop service");
startItem.enable();
stopItem.disable();
startItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
startService();
}
});
stopItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
pauseService();
}
});
menu = new PopupMenu();
menu.add(startItem);
menu.add(stopItem);
}
//初始化托盘
image = new Image() {
@Override
public ImageProducer getSource() {
// TODO Auto-generated method stub
return null;
}
@Override
public Object getProperty(String name, ImageObserver observer) {
// TODO Auto-generated method stub
return null;
}
@Override
public int getHeight(ImageObserver observer) {
// TODO Auto-generated method stub
return 0;
}
@Override
public Graphics getGraphics() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getWidth(ImageObserver observer) {
// TODO Auto-generated method stub
return 0;
详细解决方案
这代码每按一次确定内存储器占用都涨大,为什么
热度:69 发布时间:2016-04-23 22:00:09.0