webEngine.load();
を使用してHTMLまたはURLをロードしようとすると、webViewが空白になります。私がここで読んだことから、 "JavaFX 2.2 WebView"はサンドボックスモード外で動作させるためにアプリケーションに署名する必要があるようです。 http://docs.oracle.com/javafx/2/deployment/deploy_overview.htm#CEGJGHDAJavaFX FXML:ロード後の空のWebView
この問題の原因は何ですか?
私はNetBeans 8.1を使用しています。プロジェクト設定では、スタンドアロンとして実行しています。私はこれらのチュートリアルに従っており、それぞれがうまくいっています。 http://docs.oracle.com/javase/8/javafx/get-started-tutorial/get_start_apps.htm#JFXST804
ここに3つのファイルがあります。
FXML
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.media.*?>
<?import javafx.scene.web.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="481.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<AnchorPane prefHeight="18.0" prefWidth="600.0">
<children>
<HBox layoutX="157.0" layoutY="14.0" prefHeight="64.0" prefWidth="287.0">
<children>
<Label text="TwitchAid">
<font>
<Font size="53.0" />
</font>
</Label>
<ImageView fitHeight="150.0" fitWidth="38.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@Twitchaid-Logo.png" />
</image>
</ImageView>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane prefHeight="200.0" prefWidth="200.0">
<children>
<WebView fx:id="webView" prefHeight="405.0" prefWidth="600.0" />
</children>
</AnchorPane>
</children>
</VBox>
のJava
/*
* 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 twitchauthorize;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author Dylan
*/
public class TwitchAuthorize extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLTwitchAuthorize.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
stage.setResizable(false);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Controller.java
/*
* 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 twitchauthorize;
import javafx.fxml.FXML;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
/**
*
* @author Dylan
*/
public class FXMLTwitchAuthorizeController {
@FXML
private WebView webView;
@FXML
private void initialize(){
WebEngine engine = webView.getEngine();
engine.load("http://www.google.com");
}
}
彼らはそれをやっている理由は、私の質問をdownvotingている人たちが私に言うことができれば、私は喜んで情報を使用したいです私の質問を改善して禁止されないようにしてください:) – dyllandry
私はまだ投票はしませんでしたが、あなたの質問に十分な情報がないので、あなたが求めていることを完全に理解することができません。アプリケーションをどのように実行していますか?ブラウザ組み込みアプリケーションまたはWebスタートアプリケーションでない場合は、コードに署名することなく、完全なシステム権限を持ちます。 [パッケージの基礎](https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/packaging.html#BABCIBAD)からわかるように、アプリケーションをパッケージ化して実行するにはさまざまな方法があります。そうすればアプリケーション特権に影響を与えることができます。特権エラーの場合、通常はスタックトレースが存在します。 – jewelsea
ブラウザの組み込みアプリケーションの場合、htmlを表示するためのWebブラウザ内のJavaアプリケーション内にhtmlを表示するためのWebビューを埋め込むので、奇妙なアプリケーションになります。また、ブラウザ・エンベデッド・アプリケーションのサポートは、Oracleによって(近い将来廃止される予定です)(https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free)であり、すでにサポートされています。ブラウザのベンダー](https://blogs.oracle.com/java-platform-group/entry/npapi_plugin_perspectives_and_the)のどちらかを選択します。 – jewelsea