简洁!SWT实现任务栏图标,带菜单和ToolTip。
不知道哪位再把她改进改进,让任务栏不显示,只要那个托盘的。
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
51 个解决方案
#1
UP!!
收藏
收藏
#2
呵呵,谁改一下,让任务栏不显示,只显示在系统托盘。
感觉这个很简洁,既不要JNDI也不要外部包,
感觉这个很简洁,既不要JNDI也不要外部包,
#3
up 收藏
#4
up 收藏
#5
呵呵
随能改改啊?
随能改改啊?
#6
召唤强人
#7
很好
#8
UP!!
收藏
收藏
#9
召唤强人
#10
确实不错,不过楼主你的召唤术不灵啊,实在忍不住,我就来添点东西吧:
最小化时隐藏,双击tray恢复。
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//hide main
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
最小化时隐藏,双击tray恢复。
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//hide main
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#11
Call Stronger~
#12
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3139 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.win32.OS.<clinit>(OS.java:18)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:125)
at com.chance.SWT.Snippet143.main(Snippet143.java:35)
运行时候出现这个异常。谁帮忙看看了
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.win32.OS.<clinit>(OS.java:18)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:125)
at com.chance.SWT.Snippet143.main(Snippet143.java:35)
运行时候出现这个异常。谁帮忙看看了
#13
晕菜。这个东东竟然不能自己找到。还得自己解压出来。真是郁闷。呵呵。终于解决
#14
lye2000000_super(我自横刀香甜笑)
少DLL文件啦
少DLL文件啦
#15
谢
pdvv(我爱花猫) ( )
祝你早日升星星
pdvv(我爱花猫) ( )
祝你早日升星星
#16
pdvv(我爱花猫) ( )
已经接近最终目标了
谁再加工一下,
让窗体显示的时候,任务栏不显示。
((Shell)e.getSource()).setVisible(false);
这句让窗体整个都不见了,不完美。
已经接近最终目标了
谁再加工一下,
让窗体显示的时候,任务栏不显示。
((Shell)e.getSource()).setVisible(false);
这句让窗体整个都不见了,不完美。
#17
帮顶
#18
再顶。差最后一步了。
#19
顶 看过 学习过
#20
再顶。坚持!
#21
坚持到底
#22
踏個腳印
#23
等待最后的答案
#24
哈哈,看来最后的答案要归我了
在
Display display = new Display();
Shell shell = new Shell(display);
的后面加上两条语句:
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
这样窗体显示的时候,任务栏就不显示,学过WIN32 API windows编程的朋友应该看得懂
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
在
Display display = new Display();
Shell shell = new Shell(display);
的后面加上两条语句:
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
这样窗体显示的时候,任务栏就不显示,学过WIN32 API windows编程的朋友应该看得懂
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
#25
忘说了,OS这个类在 org.eclipse.swt.internal.win32包里面
#26
UP~藏收
#27
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
晕这个速度没自杀你真坚强啊
公司C2.66 + 512M
用ECLIPSE和SWT_DESINER修改一个稍微复杂一点的界面速度都要人自杀
还是偶的PM1.73+1G DDR2 533的12.1小本舒服
晕这个速度没自杀你真坚强啊
公司C2.66 + 512M
用ECLIPSE和SWT_DESINER修改一个稍微复杂一点的界面速度都要人自杀
还是偶的PM1.73+1G DDR2 533的12.1小本舒服
#28
修改后的代码:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#29
但是还不是最完美的
用了GhostValley(鬼谷)的方法以后
窗口的最小化最大化按钮没了
关闭按钮很难看
期待最后完美这个程序
用了GhostValley(鬼谷)的方法以后
窗口的最小化最大化按钮没了
关闭按钮很难看
期待最后完美这个程序
#30
透口气
#31
自己完美
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE ,OS.WS_EX_CAPTIONOKBTN);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE ,OS.WS_EX_CAPTIONOKBTN);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#32
os这个东东好强好
刚才还弄出来一个不能改变位置的窗口
谁有OS的相关资料啊
另外
怎么提交到F/Q啊
感觉这个例子很多人都需要啊
刚才还弄出来一个不能改变位置的窗口
谁有OS的相关资料啊
另外
怎么提交到F/Q啊
感觉这个例子很多人都需要啊
#33
怎么提交FAQ啊?
#34
好强!!
#35
怎么提交FAQ啊?
#36
我是JAVA初学者,我的eclipse3.1.2, 怎么无法导入这些包呢?谢谢
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
#37
不错的贴子,结贴后右上角有个提交FAQ的链接啊。
#38
mark
#39
果然强,Up 收藏~~~多谢各位牛人!
#40
mark
#41
收藏先!
#42
我也是JAVA初学者,我的eclipse3.1.2, 怎么无法导入这些包呢?
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
#43
那是因为你的电脑没有装SWT包
#44
收藏!
#45
收藏了~
#46
收藏!
#47
up
#48
在任务栏里,右键的时候会有 Item0---Item7,这几个是做什么用的 啊!!
#49
要添加org.eclipse.swt
在添加库时,选择swt库
在添加库时,选择swt库
#50
get it
#1
UP!!
收藏
收藏
#2
呵呵,谁改一下,让任务栏不显示,只显示在系统托盘。
感觉这个很简洁,既不要JNDI也不要外部包,
感觉这个很简洁,既不要JNDI也不要外部包,
#3
up 收藏
#4
up 收藏
#5
呵呵
随能改改啊?
随能改改啊?
#6
召唤强人
#7
很好
#8
UP!!
收藏
收藏
#9
召唤强人
#10
确实不错,不过楼主你的召唤术不灵啊,实在忍不住,我就来添点东西吧:
最小化时隐藏,双击tray恢复。
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//hide main
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
最小化时隐藏,双击tray恢复。
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//hide main
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#11
Call Stronger~
#12
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3139 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.win32.OS.<clinit>(OS.java:18)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:125)
at com.chance.SWT.Snippet143.main(Snippet143.java:35)
运行时候出现这个异常。谁帮忙看看了
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.win32.OS.<clinit>(OS.java:18)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:125)
at com.chance.SWT.Snippet143.main(Snippet143.java:35)
运行时候出现这个异常。谁帮忙看看了
#13
晕菜。这个东东竟然不能自己找到。还得自己解压出来。真是郁闷。呵呵。终于解决
#14
lye2000000_super(我自横刀香甜笑)
少DLL文件啦
少DLL文件啦
#15
谢
pdvv(我爱花猫) ( )
祝你早日升星星
pdvv(我爱花猫) ( )
祝你早日升星星
#16
pdvv(我爱花猫) ( )
已经接近最终目标了
谁再加工一下,
让窗体显示的时候,任务栏不显示。
((Shell)e.getSource()).setVisible(false);
这句让窗体整个都不见了,不完美。
已经接近最终目标了
谁再加工一下,
让窗体显示的时候,任务栏不显示。
((Shell)e.getSource()).setVisible(false);
这句让窗体整个都不见了,不完美。
#17
帮顶
#18
再顶。差最后一步了。
#19
顶 看过 学习过
#20
再顶。坚持!
#21
坚持到底
#22
踏個腳印
#23
等待最后的答案
#24
哈哈,看来最后的答案要归我了
在
Display display = new Display();
Shell shell = new Shell(display);
的后面加上两条语句:
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
这样窗体显示的时候,任务栏就不显示,学过WIN32 API windows编程的朋友应该看得懂
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
在
Display display = new Display();
Shell shell = new Shell(display);
的后面加上两条语句:
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
这样窗体显示的时候,任务栏就不显示,学过WIN32 API windows编程的朋友应该看得懂
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
#25
忘说了,OS这个类在 org.eclipse.swt.internal.win32包里面
#26
UP~藏收
#27
C500 CPU+128M RAM同时运行OPERA+ECLIPSE3.1.2+VC6+MSDN的速度简直能让人自杀
晕这个速度没自杀你真坚强啊
公司C2.66 + 512M
用ECLIPSE和SWT_DESINER修改一个稍微复杂一点的界面速度都要人自杀
还是偶的PM1.73+1G DDR2 533的12.1小本舒服
晕这个速度没自杀你真坚强啊
公司C2.66 + 512M
用ECLIPSE和SWT_DESINER修改一个稍微复杂一点的界面速度都要人自杀
还是偶的PM1.73+1G DDR2 533的12.1小本舒服
#28
修改后的代码:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE,OS.WS_EX_TOOLWINDOW);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#29
但是还不是最完美的
用了GhostValley(鬼谷)的方法以后
窗口的最小化最大化按钮没了
关闭按钮很难看
期待最后完美这个程序
用了GhostValley(鬼谷)的方法以后
窗口的最小化最大化按钮没了
关闭按钮很难看
期待最后完美这个程序
#30
透口气
#31
自己完美
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE ,OS.WS_EX_CAPTIONOKBTN);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
public class MyTray {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
//下面两句的效果是:在任务栏不显示
//感谢CSDN会员:GhostValley(鬼谷)
final int hWnd = shell.handle;
OS.SetWindowLong(hWnd,OS.GWL_EXSTYLE ,OS.WS_EX_CAPTIONOKBTN);
Image image = new Image(display, 16, 16);
final Tray tray = display.getSystemTray();
if (tray == null) {
System.out.println("The system tray is not available");
} else {
final TrayItem item = new TrayItem(tray, SWT.NONE);
item.setToolTipText("SWT TrayItem");
item.addListener(SWT.Show, new Listener() {
public void handleEvent(Event event) {
System.out.println("show");
}
});
item.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event event) {
System.out.println("hide");
}
});
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selection");
}
});
item.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event event) {
System.out.println("default selection");
//show main
Shell s = event.display.getShells()[0];
s.setVisible(true);
s.setMinimized(false);
}
});
final Menu menu = new Menu(shell, SWT.POP_UP);
for (int i = 0; i < 8; i++) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText("Item" + i);
}
item.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
menu.setVisible(true);
}
});
item.setImage(image);
}
shell.addShellListener(new ShellListener(){
public void shellDeactivated(org.eclipse.swt.events.ShellEvent e){
}
public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
}
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
}
public void shellDeiconified(org.eclipse.swt.events.ShellEvent e){
}
public void shellIconified(org.eclipse.swt.events.ShellEvent e){
//最小化时不显示在任务栏
//感谢CSDN会员:pdvv(我爱花猫)
((Shell)e.getSource()).setVisible(false);
}
});
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
display.dispose();
}
}
#32
os这个东东好强好
刚才还弄出来一个不能改变位置的窗口
谁有OS的相关资料啊
另外
怎么提交到F/Q啊
感觉这个例子很多人都需要啊
刚才还弄出来一个不能改变位置的窗口
谁有OS的相关资料啊
另外
怎么提交到F/Q啊
感觉这个例子很多人都需要啊
#33
怎么提交FAQ啊?
#34
好强!!
#35
怎么提交FAQ啊?
#36
我是JAVA初学者,我的eclipse3.1.2, 怎么无法导入这些包呢?谢谢
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
#37
不错的贴子,结贴后右上角有个提交FAQ的链接啊。
#38
mark
#39
果然强,Up 收藏~~~多谢各位牛人!
#40
mark
#41
收藏先!
#42
我也是JAVA初学者,我的eclipse3.1.2, 怎么无法导入这些包呢?
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
#43
那是因为你的电脑没有装SWT包
#44
收藏!
#45
收藏了~
#46
收藏!
#47
up
#48
在任务栏里,右键的时候会有 Item0---Item7,这几个是做什么用的 啊!!
#49
要添加org.eclipse.swt
在添加库时,选择swt库
在添加库时,选择swt库
#50
get it