小编use*_*188的帖子

捕获URL以在JavaFX WebView/WebEngine中使用

我正在尝试创建一个媒体流应用程序.

我有一个包含两个JFXPanel的Jframe.左侧的JFXPanel包含一个WebView,用于加载来自www.mediacollege.com的示例视频剪辑链接目录.右侧的JFXPanel还包含播放视频内容的WebView.右边的面板目前正在播放www.mediacollege.com的嵌入式链接.

有人会知道如何在点击它们时在左侧JFXPanel中捕获URL,以便我可以将它们交给右侧面板中的WebView进行查看吗?任何有关这方面的帮助将不胜感激.

package exploration_02;

import java.awt.Dimension;
import java.awt.Point;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Exploration_02 {


    private static final String MEDIA_URL = "http://www.mediacollege.com/video-gallery/testclips/testcardm-snellwilcox.flv";

    private static void initAndShowGUI() {

        //Creating the Frame
        JFrame frame = new JFrame("Exploration_02");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.getContentPane().setLayout(null); 
        //Creating the Panels, buttons not in use.
        final JButton jButton = new JButton("Button A");
        final JButton jButton1 = new JButton("Button B");
        final JFXPanel fxPanel = …
Run Code Online (Sandbox Code Playgroud)

java javafx

3
推荐指数
1
解决办法
1408
查看次数

标签 统计

java ×1

javafx ×1