风之语

posts(135) comments(158) trackbacks(1)
  • BlogJava
  • 联系
  • RSS 2.0 Feed 聚合
  • 管理

News

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • ajax(1)
  • AppFuse(1)
  • iText(1)
  • JSF(8)
  • linux(3)
  • maven(1)
  • MSTR
  • Open XML(1)
  • Oracle(8)
  • RCP
  • Struts(2)
  • SybaseIQ(6)
  • tapestry
  • tomcat(2)
  • webservice(1)
  • 收藏(25)
  • 数据仓库(9)
  • 架构设计(3)
  • 生活(1)
  • 项目管理(2)

随笔档案

  • 2008年9月 (1)
  • 2008年7月 (2)
  • 2008年6月 (4)
  • 2008年5月 (6)
  • 2008年4月 (1)
  • 2008年3月 (1)
  • 2007年12月 (2)
  • 2007年11月 (5)
  • 2007年10月 (2)
  • 2007年9月 (3)
  • 2007年8月 (3)
  • 2007年4月 (1)
  • 2007年3月 (2)
  • 2007年2月 (2)
  • 2007年1月 (2)
  • 2006年12月 (3)
  • 2006年8月 (2)
  • 2006年7月 (2)
  • 2006年6月 (2)
  • 2006年4月 (2)
  • 2006年3月 (1)
  • 2006年2月 (3)
  • 2006年1月 (6)
  • 2005年12月 (6)
  • 2005年11月 (4)
  • 2005年10月 (17)
  • 2005年9月 (26)
  • 2005年8月 (16)
  • 2005年7月 (8)

相册

  • 技术图片

收藏夹

  • java

link

My wife

  • My wife's blog

最新随笔

  • 1. 设置正确的Content-Type以解决Ext的中文乱码问题
  • 2. 关于JFreechart柱状图 柱上不能显示数值的问题
  • 3. 快速创建个性化iGoogle主题的3个方法
  • 4. Apache Maven 2 简介(目前最全的技术资料了)
  • 5. 使用 AppFuse 的七个理由
  • 6. MyEclipse 6.5注册
  • 7. tomcat中的Server.xml元素详解
  • 8. Java 使用SWT 创建COM对象
  • 9.  如何在Java中嵌入IE
  • 10. 如何在Java内读取COM接口中所有的方法和属性

搜索

  •  

积分与排名

  • 积分 - 144313
  • 排名 - 53

最新评论

  • 1. re: 一个政府项目总结
  • 政府项目只是看上去很好 实际做起来很慢 能拖死你.....
  • --testtt
  • 2. re: hibernate3 大批量更新/删除数据 (update/delete)
  • hibernate批量更新或删除效果不理想,还是绕过hibernate 用JDBC吧
  • --ssss
  • 3. re: 基于Weblogic Server 8.1 ant工具开发Web Service
  • 如果知道 问题所以请联系rxiaoliang@sina.com
  • --liuxl
  • 4. re: 基于Weblogic Server 8.1 ant工具开发Web Service
  • 评论内容较长,点击标题查看
  • --liuxl
  • 5. re: MyEclipse4.0破解[未登录]
  • 这个破解文件怎么下载不下来啊
  • --long

阅读排行榜

评论排行榜

View Post

如何在Java中嵌入IE

 

 

package com.bovy.office;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleControlSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;

public class IETest extends Shell ...{
    
/** *//** */
    
/** *//**
     * Launch the application
     * 
     * 
@param args
     
*/

    
public static void main(String args[]) ...{
        Display display 
= Display.getDefault();
        IETest shell 
= new IETest(display);
        shell.setMaximized(
true);
        shell.setLayout(
new FillLayout());
        Menu bar 
= new Menu(shell, SWT.BAR);
        shell.setMenuBar(bar);
        OleFrame frame 
= new OleFrame(shell, SWT.NONE);
        OleControlSite clientsite 
= null;
        OleAutomation browser 
= null;
        
try ...{
            clientsite 
= new OleControlSite(frame, SWT.NONE, "Shell.Explorer");
            browser 
= new OleAutomation(clientsite);
            clientsite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
            shell.open();
            
int[] browserIDs = browser.getIDsOfNames(new String[] ...{ "Navigate",
                    
"URL" }
);
            Variant[] address 
= new Variant[] ...{ new Variant(
                    
"http://blog.csdn.net/bovy") }
;
            browser.invoke(browserIDs[
0], address, new int[] ...{ browserIDs[1] });
        }
 catch (Exception ex) ...{
            System.out.println(
"Failed to create IE! " + ex.getMessage());
            
return;
        }

        
while (shell != null && !shell.isDisposed()) ...{
            
if (!display.readAndDispatch()) ...{
                display.sleep();
            }

        }

        browser.dispose();
        display.dispose();
    }


    
/** *//** */
    
/** *//**
     * Create the shell
     * 
     * 
@param display
     * 
@param style
     
*/

    
public IETest(Display display) ...{
        
super(display);
        createContents();
    }


    
/** *//** */
    
/** *//**
     * Create contents of the window
     
*/

    
protected void createContents() ...{
        setText(
"如何在Java中嵌入IE?http://blog.csdn.net/bovy");
        setMaximized(
true);
        
//
    }


    @Override
    
protected void checkSubclass() ...{
        
// Disable the check that prevents subclassing of SWT components
    }

}

posted on 2008-05-18 09:17 风 阅读(264) 评论(0)  编辑  收藏

IT新闻  新用户注册  刷新评论列表  

标题  
姓名  
主页
验证码 *  
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
 
 
相关链接:
网站导航:
博客园      BlogJava   博客生活   IT博客网   C++博客   PHP博客   博客园社区
管理博客   教师博客     天文博客   汽车博客   足球博客   股票博客   电子博客  管理
 
Powered by:
BlogJava
Copyright © 风