关于应用程序最小化的问题!!!!! 我做的程序是用swing包开发的应用程序!!现在要实现在最小化的时候让它显示在任务栏上就像是QQ一样!!!来了新消息也有提示!!!没有思路!!!各位大虾帮帮忙呀!!!!!最好是有详细的代码支持!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1.http://jeans.studentenweb.org/java/trayicon/trayicon.html2.你可以参考lumaqq,开源的qq http://community.java.net/javadesktop/这里有个例子正好对应你的问题 https://jdic.dev.java.net/files/documents/880/16463/jdic-0.9.1-bin-windows.ziphttps://jdic.dev.java.net/files/documents/880/16466/jdic-0.9.1-src.zip 刚巧以前写过,下面是代码:import org.eclipse.jface.window.*;import org.eclipse.swt.*;import org.eclipse.swt.widgets.*;import org.eclipse.swt.events.*;public class Hello3 extends ApplicationWindow{public Hello3(){super(null);}protected Control createContents(Composite parent){final Button b = new Button(parent, SWT.PUSH);b.setText("Hello World!");b.addMouseListener(new MouseAdapter(){public void mouseDoubleClick(MouseEvent e){if(b.getText().equals("Hello World!"))b.setText("Clicked");elseb.setText("Hello World!");Tray tray=Display.getCurrent().getSystemTray();TrayItem ti=new TrayItem(tray,0);ti.setToolTipText("This is a swt Tray!");ti.setImage(new org.eclipse.swt.graphics.Image(Display.getCurrent(),"E:\\My Documents\\My Pictures\\alm.gif"));//ti.setVisible(true);}});return b;}public static void main(String[] args){Hello3 w = new Hello3();w.setBlockOnOpen(true);w.open();Display.getCurrent().dispose();}}双击button则多一个System Tray Icon,退出时System Tray Icon全部消失.与Tray Icon有关的语句是:Tray tray=Display.getCurrent().getSystemTray();TrayItem ti=new TrayItem(tray,0);ti.setToolTipText("This is a swt Tray!");ti.setImage(new org.eclipse.swt.graphics.Image(Display.getCurrent(),"E:\\My Documents\\My Pictures\\alm.gif")); import org.eclipse.jface.window.*;import org.eclipse.swt.*;import org.eclipse.swt.widgets.*;import org.eclipse.swt.events.*;这些哪来的?eclipse不带这些的吧 急!请高手解决个问题! 找了份新工作,散点分? 谁知道下面的问题????????????? 路过的牛人踩一脚!!! 有谁用java开发过网管软件吗? 急求旋转图形的方法! [顶者有分]JBOSS(3.2.6)运行10小时左右会死掉,重启后恢复正常,这个问题大家碰到过吗?怎么解决?急啊!!! 汉字拆分问题 [100分]为什么类Student在继承People时老是报如下错误:急等!!!!!!!!!!!!!!!! 请问那里有tomcat4下载?? 安装了 JESE 运行时版本,能运行 J2EE程序吗? 关于hashMap中内容的顺序问题
2.你可以参考lumaqq,开源的qq
这里有个例子正好对应你的问题
https://jdic.dev.java.net/files/documents/880/16466/jdic-0.9.1-src.zip
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
public class Hello3 extends ApplicationWindow
{
public Hello3()
{
super(null);
}
protected Control createContents(Composite parent)
{
final Button b = new Button(parent, SWT.PUSH);
b.setText("Hello World!");
b.addMouseListener(new MouseAdapter(){
public void mouseDoubleClick(MouseEvent e){
if(b.getText().equals("Hello World!"))
b.setText("Clicked");
else
b.setText("Hello World!");
Tray tray=Display.getCurrent().getSystemTray();
TrayItem ti=new TrayItem(tray,0);
ti.setToolTipText("This is a swt Tray!");
ti.setImage(new org.eclipse.swt.graphics.Image(Display.getCurrent(),"E:\\My Documents\\My Pictures\\alm.gif"));
//ti.setVisible(true);
}
}
);
return b;
}
public static void main(String[] args)
{
Hello3 w = new Hello3();
w.setBlockOnOpen(true);
w.open();
Display.getCurrent().dispose();
}
}
双击button则多一个System Tray Icon,退出时System Tray Icon全部消失.
与Tray Icon有关的语句是:Tray tray=Display.getCurrent().getSystemTray();
TrayItem ti=new TrayItem(tray,0);
ti.setToolTipText("This is a swt Tray!");
ti.setImage(new org.eclipse.swt.graphics.Image(Display.getCurrent(),"E:\\My Documents\\My Pictures\\alm.gif"));
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;这些哪来的?
eclipse不带这些的吧