org.eclipse.swt.widgets.TrayItem Java Examples

The following examples show how to use org.eclipse.swt.widgets.TrayItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationMain.java    From logbook with MIT License 6 votes vote down vote up
/**
 * Open the window.
 */
public void open() {
    try {
        Display display = Display.getDefault();
        this.createContents();
        this.shell.open();
        this.shell.layout();
        while (!this.shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } finally {
        Tray tray = Display.getDefault().getSystemTray();
        if (tray != null) {
            for (TrayItem item : tray.getItems()) {
                item.dispose();
            }
        }
    }
}
 
Example #2
Source File: ApplicationMain.java    From logbook with MIT License 5 votes vote down vote up
/**
 * トレイアイコンを追加します
 *
 * @param display
 * @return
 */
private TrayItem addTrayItem(final Display display) {
    // トレイアイコンを追加します
    Tray tray = display.getSystemTray();
    TrayItem item = new TrayItem(tray, SWT.NONE);
    Image image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    item.setToolTipText(AppConstants.NAME + AppConstants.VERSION);
    item.addListener(SWT.Selection, new TraySelectionListener(this.shell));
    item.addMenuDetectListener(new TrayItemMenuListener(this.getShell()));
    return item;
}
 
Example #3
Source File: TGTray.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void removeTray(){
	if (this.tray != null) {
		setVisible(true);
		TrayItem items[] = this.tray.getItems();
		for(int i = 0; i < items.length; i ++){
			items[i].dispose();
		}
		this.menu.dispose();
	}
}
 
Example #4
Source File: TrayItemSWT.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public TrayItemSWT(TrayDelegate tray, int style) {
	item = new TrayItem(((TraySWT) tray).getSWT(), style);
}
 
Example #5
Source File: ApplicationMain.java    From logbook with MIT License 4 votes vote down vote up
/**
 * @return トレイアイコン
 */
public TrayItem getTrayItem() {
    return this.trayItem;
}
 
Example #6
Source File: TGTrayIcon.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setItem(TrayItem item){
	this.item = item;
}