zoukankan      html  css  js  c++  java
  • JWebBrower 在JAVA中嵌入浏览器

    http://blog.163.com/yingzhuo_cao/blog/static/1751111422010102973146281/

    import javax.swing.SwingUtilities;
    import chrriis.common.UIUtils;
    import chrriis.dj.nativeswing.swtimpl.NativeInterface;
    import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
     
    import java.awt.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
     
    import javax.swing.*;
     
     
     
     
    public class WebBrower {
     
    /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
                      WebBrower webbrower=new WebBrower();
    }
    public WebBrower()
    {
    SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                final JFrame frame = new JFrame("");
    //            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.getContentPane().add(new EagleBrowser
                ("http://www.baidu.com"), BorderLayout.CENTER);
     
                frame.setLocationByPlatform(true);
                frame.setAlwaysOnTop(true);
    //            frame.setUndecorated(true);
                frame.setSize(675,507);
    //            frame.setUndecorated(true);
                frame.setResizable(false);
     
                frame.addWindowListener(new WindowAdapter(){
                public void windowIconified(WindowEvent e)
                   {
                frame.setExtendedState(JFrame.ICONIFIED);
                   }
                });
                frame.setVisible(true);
     
            }
            });
           
            NativeInterface.open();
            NativeInterface.runEventPump();
             
    }
     
      
     
     
    }
        class EagleBrowser extends JPanel
    {
     
        private JPanel webBrowserPanel;
        private chrriis.dj.nativeswing.swtimpl.components.JWebBrowser webBrowser;
        private String url;
     
        public EagleBrowser(String url)
        {
             super(new BorderLayout());
             this.url = url;
             webBrowserPanel = new JPanel(new BorderLayout());
             webBrowser = new chrriis.dj.nativeswing.swtimpl.components.JWebBrowser();
             webBrowser.navigate(url);
             webBrowser.setButtonBarVisible(false);
             webBrowser.setMenuBarVisible(false);
             webBrowser.setBarsVisible(false);
             webBrowser.setStatusBarVisible(false);
             webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
             add(webBrowserPanel, BorderLayout.CENTER);
        }
    I'm falling off the sky all alone.The courage inside is gonna break the fall. Nothing can dim my light within. I am That I am 程序 = 数据结构 + 算法
  • 相关阅读:
    is_numeric — 检测变量是否为数字或数字字符串
    intval — 获取变量的整数值
    php获取数组最后一个值
    js正則匹配经纬度(经纬度逗号隔开)
    安装netcat(-bash: netcat: command not found)
    提示-bash: telnet: command not found的解决方法
    Laravel中使用Redis
    鏈接Redis報錯`AUTH` failed: ERR Client sent AUTH, but no password is set [tcp://127.0.0.1:6379]
    使用composer遇到的坑
    laravel的ORM模型的find(),findOrFail(),first(),firstOrFail(),get(),list(),toArray()之间的区别
  • 原文地址:https://www.cnblogs.com/IamThat/p/2954414.html
Copyright © 2011-2022 走看看