JAVAFX嵌入html页面
javafx嵌入html页面
使用fjavafx嵌入html页面需要先创建一个fxml页面,页面中放入一个WebView,具体嵌入的代码在后台fxml对应的controller中操作
FXML页面代码
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.web.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sky.ht.view.setting.SettingController">
<children>
<WebView fx:id="webView" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
fx:controller=“com.sky.ht.view.setting.SettingController”>