为什么JFXPanel在我的Web浏览器中不起作用

时间:2019-10-22 19:27:41

标签: java netbeans

对于在YouTube上创建浏览器教程的人来说,为什么JFXPanel不能正常工作

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package simplewebbrowser;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JMenu;

/**
 *
 * @author 23 _________)
 */
public class SimpleWebBrowser {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setSize(620,440);
        final JFXPanel fxpanel = new JPanel();
        frame.add(fxpanel);

        Platform.runLater(new Runnable() {
            @Override
            public void run(){
                WebEngine engine;
                WebView wv= new  WebView();
                engine = wv.getEngine();
                fxpanel.setScene(new Scene (wv));
                engine.load("https://www.ebay.com.au");      

        }
     });
    frame.setVisible(true)``; 
    }
}

我尝试添加更多的导入内容,以为输入的内容会随着该人的输入而自动导入,但没有用

0 个答案:

没有答案