在java 中怎么样可以打开一个特定的应用程序,象doc,txt,pfd,gif,jpg等对用的应用程序,并且使这个应用程序显示于一个java的容器中?用什么容器可以实现啊? 希望各位帮忙我知道用runtime.getruntime(".\\command.exe filepath");可以打开一个应用,但不知道如何将这个应用程序包容在一个类似于panel一样的容器中!关注各位的赐教!在线等候!

解决方案 »

  1.   

    不懂你的意思,你是要用swing作一个类似的打开文件的选择界面么
      

  2.   

    谢谢各位的回复!
    我是要用一个容器,包住外部应用程序,比如说:我让word应用程序,打开后,不是全屏幕或自由显示,是将它的框架限制在一个我自己的容器中!
      

  3.   

    如何用特定的方法,打开一个程序啊,在不自到程序路径的情况下
    比如 我想打开也doc文件,但不知道word安装的路径,怎么打开啊,用runtime.exe("word完整路径","dd.doc");可以打开,但如果不知道word程序的安装路径应该怎么办啊,请各位帮忙!
      

  4.   

    上面这个方法直接 runtime.exe("dd.doc" ) 不行么?
      

  5.   

    呵呵,给你一个去查问题的思路。现在的OA(办公自动化)系统都是B/S模式的,常常需要在网上进行WORD、EXCEL格式的文件操作,都是用APPLET来实现的。你去网上查查这个相关的,应该有很多资料的。PS:以前一个组的人做过,具体技术细节我不清楚。
      

  6.   

    但是用applet得话,就只能在外部得applet中打开了,但我想在我程序主窗口得一个pane中打开,能不能把applet内嵌到pane中啊,????还有上面有朋友说到,用runtime.exec(dd.doc)打开,但这样打开的是一个纯粹的外部程序,我想把打开的dd.doc嵌一个pane中啊各位帮忙!!!!
      

  7.   

    创建一个新类实现AppletStub和AppletContext接口便可在应用程序中打开Applet,我只用窗口打开过applet,pane还没试过,楼主自己试试吧,估计能行
      

  8.   

    给你一个例子吧
    yourFrame: 装载Applet的窗口
    yourApplet: 将要装载的Appletclass yourFrame extends JFrame
                 implements AppletStub, AppletContext
    {
        public yourFrame(Applet yourApplet)
        {
           applet=yourApplet;
           getContentPane().add(applet);
           applet.setStub(this);
        }    public void show()
        {
           applet.init();
           super.show();
           applet.start();
        }
            // AppletStub Method
        public boolean isActive()  { return true; }
        public URL getDocumentBase()  { return null; }
        public URL getCodeBase()  {  return null;  }
        public String getParameter(String name)  { return "";  }
        public AppletContext getAppletContext()  { return this; }
        public void appletResize(int width,int height)  {}
       
        // AppletContext methods
        public AudioClip getAudioClip(URL url)  { return null; }
        public Image getImage(URL url)  { return null; }
        public Applet getApplet(String name)  { return null; }
        public Enumeration getApplets()  { return null; }
        public void showDocument(URL url)  { }
        public void showDocument(URL url,String target)  { }
        public void showStatus(String status)  { }
        public InputStream getStream(String key)  { return null; }
        public Iterator getStreamKeys()  { return null; }
        public void setStream(String key,InputStream stream) throws IOException  { }    private Applet applet;
    }
      

  9.   

    找了好长时间了,也没收获!郁闷!还有java c/s水晶报表也搞不定,不知道如何查看报表,那个浏览报表的组件是找到了,但就只怎么设置报表也不出来,郁闷!
      

  10.   

    至今这个问题还没有实际解决,现在暂且用外部的word程序打开一个文件了,没有实现在一个程序窗口中打开word,希望有兴趣的同志跟我联系,以后多交流!现在版主要求结贴了,给各位散分,谢谢各位参与讨论!