Ответ 1
Попробуйте использовать Java 8u112, основанный на вашем коде, я создал рабочий образец (протестирован с использованием Java JDK 8u112 64 бит):
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class Example extends Application
{
public static void main(String[] args)
{
launch(args);
}
class MyBrowser extends Parent
{
private WebEngine webEngine;
private WebView webView;
public MyBrowser()
{
webView = new WebView();
webEngine = webView.getEngine();
// Ugly (but easy to share) HTML content
String pageContents =
"<html>"
+ "<head>"
+ "<style>"
+ "@-webkit-keyframes mymove {"
+ "from {top: 0px;}"
+ "to {top: 50px;}"
+ "}"
+ ".box { "
+ "width: 150px; "
+ "position: relative; "
+ "height: 150px; "
+ "background: red; "
+ "margin-top: 35px; "
+ "margin-left: auto; "
+ "margin-right: auto; "
+ "-webkit-transition: background-color 2s ease-out; "
+ "-webkit-transition: all 1s ease-in-out; "
+ "}"
+".box:hover {"
+" background-color: green;"
+ "width:350px;"
+ "-webkit-animation: mymove 1s infinite;"
+"}"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<div class='box'></div>"
+ "</body>"
+ "</html>";
webEngine.loadContent(pageContents);
webView.setContextMenuEnabled(false);
getChildren().add(webView);
}
}
private Scene scene;
MyBrowser myBrowser;
@Override
public void start(Stage primaryStage) throws Exception
{
primaryStage.setTitle("Frontend");
myBrowser = new MyBrowser();
scene = new Scene(myBrowser);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Я подозреваю, что это потому, что они теперь используют новый webkit JDK-8156698, но это может быть ошибка раньше (вы можете принять посмотрите ошибка 8u112 исправляет список.