Java SWT????????????
???????????? ???????[ 2013/8/8 15:00:52 ] ????????
????//?????????С??????????????????????????? ??????????????????????е?
????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)??
}
})??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11