`

JAVA(GUI)中嵌入浏览器页面

阅读更多
    我们可以使用JDIC来调用WebBrowser控件来显示。。
    代码如下:
   
    WebBrowser browser;
	public static void main(String[] args) throws IOException, URISyntaxException {
		// TODO Auto-generated method stub
		tEST test=new tEST();
		test.setSize(300, 300);
		test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		test.setVisible(true);
		
	}
	public tEST() throws IOException, URISyntaxException{
	
		Container container=getContentPane();
		    browser = new WebBrowser(); 
		        try {  
		            browser.setURL(new URL("http://www.google.com"));  
		            BrowserEngineManager engineManager = BrowserEngineManager.instance();  
		            engineManager.setActiveEngine(BrowserEngineManager.IE);  //指定IE浏览器  
		      
		     }catch(Exception ex){}  
		     container.add(browser);
//		     container.add(linklabel);
		     
	}
    


当然还需要添加下类库;添加jdic.dll、tray.dll和IeEmbed.exe到System32中,,在工程中加入jdic的jar包。
这样web页面在jframe中出现了。。
    jdic.jar
   jdic.dll、tray.dll和IeEmbed.exe

   
分享到:
评论
1 楼 u148 2014-08-22  
为什么还是显示不出来?..

相关推荐

Global site tag (gtag.js) - Google Analytics