本文整理汇总了Java中org.eclipse.swt.widgets.Tray类的典型用法代码示例。如果您正苦于以下问题:Java Tray类的具体用法?Java Tray怎么用?Java Tray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tray类属于org.eclipse.swt.widgets包,在下文中一共展示了Tray类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import org.eclipse.swt.widgets.Tray; //导入依赖的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.Tray; //导入依赖的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.Tray; //导入依赖的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: addTrayItem
import org.eclipse.swt.widgets.Tray; //导入依赖的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: addTrayItem
import org.eclipse.swt.widgets.Tray; //导入依赖的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;
}
示例6: addTrayItem
import org.eclipse.swt.widgets.Tray; //导入依赖的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: toggleDisplay
import org.eclipse.swt.widgets.Tray; //导入依赖的package包/类
/**
* 窗口是可见状态时,则隐藏窗口,同时把系统栏中图标删除 窗口是隐藏状态时,则显示窗口,并且在系统栏中显示图标
*
* @param shell
* 窗口
* @param tray
* 系统栏图标控件
*/
private void toggleDisplay(Shell shell, Tray tray) {
try {
shell.setVisible(!shell.isVisible());
if (shell.getVisible()) {
shell.setMinimized(false);
shell.setActive();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: initTaskItem
import org.eclipse.swt.widgets.Tray; //导入依赖的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;
}
示例9: getSWT
import org.eclipse.swt.widgets.Tray; //导入依赖的package包/类
public Tray getSWT() {
return tray;
}
示例10: getTray
import org.eclipse.swt.widgets.Tray; //导入依赖的package包/类
public Tray getTray() {
return tray;
}