我做的程序是用swing包开发的应用程序!!
现在要实现在最小化的时候让它显示在任务栏上
就像是QQ一样!!!来了新消息也有提示!!!
没有思路!!!
各位大虾帮帮忙呀!!!!!
最好是有详细的代码支持!!!!

解决方案 »

  1.   

    1.http://jeans.studentenweb.org/java/trayicon/trayicon.html
    2.你可以参考lumaqq,开源的qq
      

  2.   

    http://community.java.net/javadesktop/
    这里有个例子正好对应你的问题
      

  3.   

    https://jdic.dev.java.net/files/documents/880/16463/jdic-0.9.1-bin-windows.zip
    https://jdic.dev.java.net/files/documents/880/16466/jdic-0.9.1-src.zip
      

  4.   

    刚巧以前写过,下面是代码: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");
    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"));
      

  5.   

    import org.eclipse.jface.window.*;
    import org.eclipse.swt.*;
    import org.eclipse.swt.widgets.*;
    import org.eclipse.swt.events.*;这些哪来的?
    eclipse不带这些的吧