本文整理汇总了Java中org.eclipse.swt.widgets.TrayItem类的典型用法代码示例。如果您正苦于以下问题:Java TrayItem类的具体用法?Java TrayItem怎么用?Java TrayItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TrayItem类属于org.eclipse.swt.widgets包,在下文中一共展示了TrayItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
/**
* 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();
}
}
}
}
示例2: 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);
}
}
示例3: TrayIcon
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
public TrayIcon(Display display, MainWindow window) {
if(display == null) { throw new NullPointerException("Display cannot be null."); }
if(window == null) { throw new NullPointerException("Main window cannot be null."); }
m_mainDisplay = display;
m_mainWindow = window;
// Create tray item
Tray tray = display.getSystemTray();
m_item = new TrayItem(tray, SWT.NONE);
m_item.setText("Droid Navi");
// Set Image
m_logo = AppLogo.getLogo(AppLogo.LogoType.TRAY_ICON, display);
m_item.setImage(m_logo);
init(m_item);
}
示例4: showTrayItemTooltipMessage
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
public static void showTrayItemTooltipMessage(final TrayItem trayItem, final String title, final String message)
{
final Shell sShell = MailsterSWT.getInstance().getShell();
Display.getDefault().asyncExec(new Thread() {
public void run()
{
final ToolTip tip = new ToolTip(sShell, SWT.BALLOON | SWT.ICON_INFORMATION);
tip.setMessage(message);
tip.setText(title);
if (Display.getDefault().getSystemTray() != null)
trayItem.setToolTip(tip);
else
tip.setLocation(sShell.getLocation());
tip.setVisible(true);
tip.setAutoHide(ConfigurationManager.CONFIG_STORE.getBoolean(ConfigurationManager.AUTO_HIDE_NOTIFICATIONS_KEY));
}
});
}
示例5: removeTray
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
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();
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: removeTray
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
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.icon.dispose();
this.menu.dispose();
}
}
示例10: performInitializations
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
@Override
public void performInitializations() {
controller = new GadgetController(this);
imageContainer = new Label(getShell(), SWT.NO_TRIM);
tray = new TrayItem(Display.getDefault().getSystemTray(), SWT.NONE);
trayMenu = new Menu(this.getShell(), SWT.POP_UP);
openJobs = new MenuItem(trayMenu, SWT.PUSH);
openChat = new MenuItem(trayMenu, SWT.PUSH);
openSettings = new MenuItem(trayMenu, SWT.PUSH);
exitApp = new MenuItem(trayMenu, SWT.PUSH);
}
示例11: 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);
}
示例12: initTaskItem
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
private TrayItem initTaskItem(Shell shell) {
final Tray tray = shell.getDisplay().getSystemTray();
TrayItem trayItem = new TrayItem(tray, SWT.NONE);
trayImage = AbstractUIPlugin.imageDescriptorFromPlugin(
"com.dmagik.sheetrackimporter", "/icons/alt_window_16.gif")
.createImage();
trayItem.setImage(trayImage);
trayItem.setToolTipText("Double-click to maximize SheetRack Importer");
return trayItem;
}
示例13: create
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
static SelectionAdapter create(Widget widget) {
if (widget instanceof Button) {
return create((Button) widget);
} else if (widget instanceof CCombo) {
return create((CCombo) widget);
} else if (widget instanceof Combo) {
return create((Combo) widget);
} else if (widget instanceof CoolItem) {
return create((CoolItem) widget);
} else if (widget instanceof CTabFolder) {
return create((CTabFolder) widget);
} else if (widget instanceof DateTime) {
return create((DateTime) widget);
} else if (widget instanceof Link) {
return create((Link) widget);
} else if (widget instanceof List) {
return create((List) widget);
} else if (widget instanceof MenuItem) {
return create((MenuItem) widget);
} else if (widget instanceof Sash) {
return create((Sash) widget);
} else if (widget instanceof Scale) {
return create((Scale) widget);
} else if (widget instanceof Slider) {
return create((Slider) widget);
} else if (widget instanceof Spinner) {
return create((Spinner) widget);
} else if (widget instanceof StyledText) {
return create((StyledText) widget);
} else if (widget instanceof TabFolder) {
return create((TabFolder) widget);
} else if (widget instanceof Table) {
return create((Table) widget);
} else if (widget instanceof TableColumn) {
return create((TableColumn) widget);
} else if (widget instanceof TableCursor) {
return create((TableCursor) widget);
} else if (widget instanceof Text) {
return create((Text) widget);
} else if (widget instanceof ToolItem) {
return create((ToolItem) widget);
} else if (widget instanceof ToolTip) {
return create((ToolTip) widget);
} else if (widget instanceof TrayItem) {
return create((TrayItem) widget);
} else if (widget instanceof Tree) {
return create((Tree) widget);
} else if (widget instanceof TreeColumn) {
return create((TreeColumn) widget);
} else if (widget instanceof TreeCursor) {
return create((TreeCursor) widget);
}
throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported.");
}
示例14: TrayItemSWT
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
public TrayItemSWT(TrayDelegate tray, int style) {
item = new TrayItem(((TraySWT) tray).getSWT(), style);
}
示例15: setItem
import org.eclipse.swt.widgets.TrayItem; //导入依赖的package包/类
public void setItem(TrayItem item){
this.item = item;
}