本文整理汇总了Java中org.eclipse.swt.widgets.TrayItem.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java TrayItem.addListener方法的具体用法?Java TrayItem.addListener怎么用?Java TrayItem.addListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TrayItem
的用法示例。
在下文中一共展示了TrayItem.addListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTrayItem
import org.eclipse.swt.widgets.TrayItem; //导入方法依赖的package包/类
private void addTrayItem() {
Display display;
Tray tray;
Shell shell;
display = Main.getDisplay();
tray = display.getSystemTray();
shell = Main.getShell();
if (tray != null) {
trayItem = new TrayItem(tray, SWT.NONE);
trayItem.setToolTipText("Dazzl"); //$NON-NLS-1$
trayItem.setImage(admIcon); //$NON-NLS-1$
trayItem.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
if (menu != null) {
menu.setVisible(true);
}
}
});
} else {
CommonDialogs.showError(Messages
.getString("SystemTray.error.no_system_tray"), null);
}
}
示例2: addTrayItem
import org.eclipse.swt.widgets.TrayItem; //导入方法依赖的package包/类
/**
* トレイアイコンを追加します
*
* @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;
}
示例3: addTrayItem
import org.eclipse.swt.widgets.TrayItem; //导入方法依赖的package包/类
/**
* トレイアイコンを追加します
*
* @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;
}
示例4: addTrayItem
import org.eclipse.swt.widgets.TrayItem; //导入方法依赖的package包/类
/**
* トレイアイコンを追加します
*
* @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;
}
示例5: show
import org.eclipse.swt.widgets.TrayItem; //导入方法依赖的package包/类
public void show() {
ImageRepository imageRepository = imageRepositoryProvider.get();
trayItem = new TrayItem(shell.getDisplay().getSystemTray(), SWT.NULL);
imageList = new Image[2];
imageList[0] = imageRepository.getImage("fullsync48.png"); //$NON-NLS-1$
imageList[1] = imageRepository.getImage("fullsync48_r.png"); //$NON-NLS-1$
imageActive = 0;
// initialize trayItem
trayItem.setImage(imageList[0]);
trayItem.setToolTipText("FullSync"); //$NON-NLS-1$
trayItem.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true));
trayItem.addListener(SWT.DefaultSelection, e -> mainWindowProvider.get().setVisible(true));
trayItem.addListener(SWT.MenuDetect, e -> menu.setVisible(true));
// initialize popup menu
menu = new Menu(shell, SWT.POP_UP);
MenuItem item;
item = new MenuItem(menu, SWT.NULL);
item.setImage(imageRepository.getImage("fullsync16.png"));
item.setText(Messages.getString("SystemTrayItem.OpenFullSync")); //$NON-NLS-1$
item.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true));
item = new MenuItem(menu, SWT.NULL);
item.setText(Messages.getString("SystemTrayItem.Exit")); //$NON-NLS-1$
item.addListener(SWT.Selection, e -> guiControllerProvider.get().closeGui());
taskGeneratorProvider.get().addTaskGenerationListener(this);
}