JNI,JNI
都说JNI
难道用JAVA不能实现吗
我现在在想
为了实现一些在C++等里面很容易实现的功能
我们需要SWT,JNI
还不如直接去学C++

解决方案 »

  1.   


    JNI,JNI
    都说JNI
    难道用JAVA不能实现吗
    我现在在想
    为了实现一些在C++等里面很容易实现的功能
    我们需要SWT,JNI
    还不如直接去学C++
    难道JAVA真的不如人吗?
      

  2.   

    由于这托盘功能不是所有的操作系统都支持,所以java好像没有直接支持。建议你不要用不跨平台的功能开源BT下载软件azureus是java写的,它可以做到,你去看看它的源代码吧。不过它是用SWT
      

  3.   

    我要用java建一个快捷方式出来,都不可能,脱离了平台,要实现这些功能就是不方面,都说jni,jni,真正会用的又有多少人
      

  4.   

    唉!是啊JAVA为了跨平台牺牲太多了!
    谁有SWT的学习资料啊?
      

  5.   

    包装好的jni:
    https://jdic.dev.java.net/
    有一个跨平台的tray icon api.
    其实linux上的kde,gnome都有system tray.可以做系统托盘式程序,上面的api可以生成相同代码的跨平台系统托盘式程序.还可以用swt
      

  6.   

    呵呵
    楼上SWT的能祥解吗?
    谢啦
      

  7.   

    swt的例子:
    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"));
      

  8.   

    各们学长请问一下eclipse从哪来的呀!
      

  9.   

    怎样连任务栏也不显示?这倒很简单,不管是awt,swing,还是swt只要一句:
    frame.hide();
      

  10.   

    对哦
    没想起来
    厉害
    呵呵
    这么简单没想到
    呵呵
    TO:playmaker(后卫)  去他官方网站下吧,有中文包