jdic桌面应用工具

  1.   1. webBrowser监听器,用于监听webBrowser的状态,在调用setURl或者setConetent后,马上调用exectescrip和getContentt可能异常,内容可能还没加载到浏览器里面。要在监听中等待加载完成,才能调用

webBrowser.addWebBrowserListener(new WebBrowserListener() {
            public void downloadStarted(WebBrowserEvent event) {
                updateStatusInfo("Loading started.");
            }

            public void downloadCompleted(WebBrowserEvent event) {
                jBackButton.setEnabled(webBrowser.isBackEnabled());
                jForwardButton.setEnabled(webBrowser.isForwardEnabled());

                updateStatusInfo("Loading completed.");

                URL currentUrl = webBrowser.getURL();

                if (currentUrl != null) {
                    jAddressTextField.setText(currentUrl.toString());
                }
            }

            public void downloadProgress(WebBrowserEvent event) {
                // updateStatusInfo("Loading in progress...");
            }

            public void downloadError(WebBrowserEvent event) {
                updateStatusInfo("Loading error.");
            }

            public void documentCompleted(WebBrowserEvent event) {
                updateStatusInfo("Document loading completed.");
            }

            public void titleChange(WebBrowserEvent event) {
                updateStatusInfo("Title of the browser window changed.");
            } 

            public void statusTextChange(WebBrowserEvent event) {
                // updateStatusInfo("Status text changed.");
            }
            public void windowClose(WebBrowserEvent event) {
                updateStatusInfo("Closed by script.");
                if(JOptionPane.YES_OPTION==JOptionPane.showConfirmDialog(
                    webBrowser,
                    "The webpage you are viewing is trying to close the window./n Do you want to close this window?",
                    "Warning",
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE))
                {
                     System.exit(0);
                }
            }
        }); 

2.tray添加java程序到任务栏中,通过点击tray设置Jframe是否显示,可以在tray中加入Jpopmenu设置弹出菜单

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值