????//?????????С???????????????????????????    ??????????????????????е?

????public class TrayApp {

????public static void main(String[] args) {

????Display display = new Display()??

????final Shell shell = new Shell(display)??

????shell.setText("С?????????")??

????//??????????????????????????????

????shell.setImage(display.getSystemImage(SWT.ICON_INFORMATION))??

????//????????

????final Tray tray = display.getSystemTray()??

????final TrayItem trayItem = new TrayItem(tray?? SWT.NONE)??

????//???????????????????

????trayItem.setImage(display.getSystemImage(SWT.ICON_INFORMATION))??

????//????????????????????????????????

trayItem.setVisible(false)??
trayItem.setToolTipText(shell.getText())??
trayItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
toggleDisplay(shell?? tray)??
}
})??
final Menu trayMenu = new Menu(shell?? SWT.POP_UP)??
MenuItem showMenuItem = new MenuItem(trayMenu?? SWT.PUSH)??
showMenuItem.setText("??????(&s)")??

????//?????????????????

showMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
toggleDisplay(shell?? tray)??
}
})??
trayMenu.setDefaultItem(showMenuItem)??
new MenuItem(trayMenu?? SWT.SEPARATOR)??

????//????е?????????????????????????

MenuItem exitMenuItem = new MenuItem(trayMenu?? SWT.PUSH)??
exitMenuItem.setText("??????(&x)")??
exitMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
shell.dispose()??
}
})??

????//???????????????????????????????

trayItem.addMenuDetectListener(new MenuDetectListener() {
public void menuDetected(MenuDetectEvent e) {
trayMenu.setVisible(true)??
}
})??