private ImageIcon image = null; private int status = 0;
private ArrayList mouseListeners = new ArrayList(); private TrayIconEvent event = new TrayIconEvent(); static { }
private TrayIcon() { }
public void addTrayIconListener(TrayIconListener listener) { }
public void removeTrayIconListener(TrayIconListener listener) { }
private void callDownListener(TrayIconEvent event) { }
private void callUPListener(TrayIconEvent event) { }
private void callClickListener(TrayIconEvent event) {
TrayIconListener listener = null; TrayIconListener listener = null;
for (int i = 0; i < mouseListeners.size(); i++) { }
listener = (TrayIconListener) mouseListeners.get(i); event.setSource(listener);
listener.trayIconReleased(event); TrayIconListener listener = null;
for (int i = 0; i < mouseListeners.size(); i++) { }
listener = (TrayIconListener) mouseListeners.get(i); event.setSource(listener); listener.trayIconPressed(event); mouseListeners.remove(listener); mouseListeners.add(listener); try { }
System.loadLibrary(\); e.printStackTrace(); } catch (Exception e) {
- 26 -
}
for (int i = 0; i < mouseListeners.size(); i++) { }
listener = (TrayIconListener) mouseListeners.get(i); event.setSource(listener); listener.trayIconClicked(event);
private void callDBLClickListener(TrayIconEvent event) { }
private void trayIconCallback(int button, int x, int y) {
event.setX(x); event.setY(y); if (button == 7) {
event.setButton(1);
this.callDBLClickListener(event); if (button == 2)
event.setButton(1); event.setButton(3); event.setButton(2); else if (button == 4) else if (button == 6)
TrayIconListener listener = null;
for (int i = 0; i < mouseListeners.size(); i++) { }
listener = (TrayIconListener) mouseListeners.get(i); event.setSource(listener);
listener.trayIconDBLClicked(event);
} else if (button == 2 || button == 4 || button == 6) {
if (button == 2 && status == 1) { }
this.callUPListener(event); if (button == 1)
event.setButton(1); event.setButton(3); else if (button == 2) else if (button == 3)
this.callClickListener(event); this.callClickListener(event); this.callClickListener(event); } else if (button == 4 && status == 3) { } else if (button == 6 && status == 5) {
} else if (button == 1 || button == 3 || button == 5) {
- 27 -
}
}
event.setButton(2);
this.callDownListener(event);
status = button;
public static TrayIcon createTrayIcon() { }
public void setTrayIconToolTip(String tooltip) { }
public String getTrayIconToolTip() { }
public void setImageIcon(ImageIcon image) { }
public ImageIcon getImageIcon() {
return image;
if (image != null) { }
int width = image.getIconWidth(); int height = image.getIconHeight(); int[] pixels = new int[width * height]; try { }
PixelGrabber pixelGrabber = new PixelGrabber(image.getImage(),
0, 0, width, height, pixels, 0, width);
pixelGrabber.grabPixels();
if ((pixelGrabber.getStatus() & ImageObserver.ABORT) != 0)
throw new Exception(\); this.setTrayIconData(width, height, pixels); this.image = image; e.printStackTrace();
return tooltip;
this.tooltip = tooltip; this.setTrayIconTip(tooltip); if (staticInstance == null) { }
return staticInstance;
staticInstance = new TrayIcon();
staticInstance.initTrayIcon(staticInstance, \, 1000);
} catch (Exception e) {
- 28 -
}
}
private native void initTrayIcon(TrayIcon instance, String applicationName,
int id);
private native void setTrayIconTip(String tooltip);
private native void setTrayIconData(int w, int h, int pixels[]); public native void show(); public native void close();
TrayIconEvent.java
package eb.cstop.swt;
public class TrayIconEvent {
private int button = -1; private Object source = null; private int x = 0; private int y = 0;
public int getButton() { }
protected void setButton(int button) { }
public Object getSource() { }
protected void setSource(Object source) { }
public int getX() { }
protected void setX(int x) { }
public int getY() {
return y; this.x = x; return x;
this.source = source; return source;
this.button = button; return button;
- 29 -
}
}
protected void setY(int y) {
this.y = y; }
TrayIconListener.java
package eb.cstop.swt;
public interface TrayIconListener { }
public void trayIconPressed(TrayIconEvent e); public void trayIconReleased(TrayIconEvent e); public void trayIconClicked(TrayIconEvent e); public void trayIconDBLClicked(TrayIconEvent e);
ParameterManager.java
package eb.cstop.util; /**
*
Title: 参数管理器
*
Description: 生成XML文挡或二维视图支持Ajax
*/import java.util.ArrayList;
public class ParameterManager {
private ArrayList contentList = new ArrayList();//存放主XML字符串 private String[] fileds;//字段名称 private int currentIndex = -1;//当前行
public ParameterManager(){ }
public ParameterManager(String[] fileds){ }
public void setField(String[] fileds){ }
this.fileds = fileds; this.fileds = fileds; this(null);
- 30 -