<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                JxBrowser提供允許處理所有文件下載的API。使用此API,您可以控制應下載哪些文件,提供必須保存文件的目標目錄的路徑以及跟蹤下載進度。 您可以注冊自己的DownloadHandler接口實現,以自己的方式處理文件下載。以下示例演示了如何執行此操作: ``` browser.setDownloadHandler(new DownloadHandler() { public boolean allowDownload(DownloadItem download) { download.addDownloadListener(new DownloadListener() { public void onDownloadUpdated(DownloadEvent event) { DownloadItem download = event.getDownloadItem(); if (download.isCompleted()) { System.out.println("Download is completed!"); } } }); System.out.println("Dest file: " + download.getDestinationFile().getAbsolutePath()); return true; } }); ``` 該DownloadItem 類提供了暫停和取消下載過程的方法。請參閱其相應的方法。 完整的示例演示了如何注冊您自己的DownloadHandler實現,您可以在下面找到: ``` import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.DownloadHandler; import com.teamdev.jxbrowser.chromium.DownloadItem; import com.teamdev.jxbrowser.chromium.events.DownloadEvent; import com.teamdev.jxbrowser.chromium.events.DownloadListener; import com.teamdev.jxbrowser.chromium.swing.BrowserView; import javax.swing.*; import java.awt.*; /** * The sample demonstrates how to handle file download. To cancel download * you must return {@code false} from the * {@link DownloadHandler#allowDownload(com.teamdev.jxbrowser.chromium.DownloadItem)} * method. To listed for download update events you can register your own * {@link com.teamdev.jxbrowser.chromium.events.DownloadListener}. */ public class DownloadSample { public static void main(String[] args) { Browser browser = new Browser(); BrowserView view = new BrowserView(browser); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(view, BorderLayout.CENTER); frame.setSize(800, 600); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.setDownloadHandler(new DownloadHandler() { public boolean allowDownload(DownloadItem download) { download.addDownloadListener(new DownloadListener() { public void onDownloadUpdated(DownloadEvent event) { DownloadItem download = event.getDownloadItem(); if (download.isCompleted()) { System.out.println("Download is completed!"); } } }); System.out.println("Destination file: " + download.getDestinationFile().getAbsolutePath()); return true; } }); browser.loadURL("ftp://ftp.teamdev.com/updates/jxbrowser-4.0-beta.zip"); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看