Added a WebView to a BorderPane and pressed right mouse over the web view. Got the following exception:
java.lang.ClassCastException: javafx.scene.layout.BorderPane cannot be cast to javafx.scene.Group
at com.sun.webpane.sg.theme.PopupMenuImpl.doShow(PopupMenuImpl.java:104)
at com.sun.webpane.sg.theme.ContextMenuImpl.show(ContextMenuImpl.java:62)
at com.sun.webpane.platform.ContextMenu.fwkShow(ContextMenu.java:40)
at com.sun.webpane.platform.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webpane.platform.WebPage.dispatchMouseEvent(WebPage.java:690)
at javafx.scene.web.WebView.processMouseEvent(WebView.java:366)
at javafx.scene.web.WebView.access$100(WebView.java:41)
at javafx.scene.web.WebView$2.handle(WebView.java:396)
at javafx.scene.web.WebView$2.handle(WebView.java:394)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:55)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchBubblingEvent(DefaultEventDispatcher.java:173)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchBubblingEvent(DefaultEventDispatcher.java:157)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:120)
at javafx.scene.Node$7.dispatchEvent(Node.java:3900)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:118)
at javafx.scene.Node$7.dispatchEvent(Node.java:3900)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:118)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventRedirector.dispatchEvent(EventRedirector.java:79)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at javafx.event.Event.fireEventImpl(Event.java:172)
at javafx.event.Event.fireEvent(Event.java:162)
at javafx.scene.Node.fireEvent(Node.java:4005)
at javafx.scene.Scene$MouseHandler.process(Scene.java:1913)
at javafx.scene.Scene$MouseHandler.process(Scene.java:1754)
at javafx.scene.Scene$MouseHandler.access$600(Scene.java:1726)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:883)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:1381)
at com.sun.javafx.tk.glass.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:91)
at com.sun.glass.ui.View.handleMouseEvent(View.java:259)
at com.sun.glass.ui.View.notifyMouse(View.java:498)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:14)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:33)
at java.lang.Thread.run(Thread.java:619)
Test app:
public class BrowserApp extends Application
{
public static void main(String[] pArgs)
{
Launcher.launch(BrowserApp.class, pArgs);
}
@Override
public void start(Stage pStage)
{
BorderPane bpane = new BorderPane();
WebEngine webe = new WebEngine();
webe.setUrl("http://www.sibvisions.com");
WebView webv = new WebView(webe);
webv.setPrefSize(500, 400);
bpane.setCenter(webv);
// bpane.setStyle("-fx-background-color: #888888;");
// Group group = new Group();
// group.getChildren().add(webv);
//
// Scene scene = new Scene(group);
Scene scene = new Scene(bpane);
pStage.setWidth(1000);
pStage.setHeight(500);
pStage.setScene(scene);
pStage.setVisible(true);
}
}
java.lang.ClassCastException: javafx.scene.layout.BorderPane cannot be cast to javafx.scene.Group
at com.sun.webpane.sg.theme.PopupMenuImpl.doShow(PopupMenuImpl.java:104)
at com.sun.webpane.sg.theme.ContextMenuImpl.show(ContextMenuImpl.java:62)
at com.sun.webpane.platform.ContextMenu.fwkShow(ContextMenu.java:40)
at com.sun.webpane.platform.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webpane.platform.WebPage.dispatchMouseEvent(WebPage.java:690)
at javafx.scene.web.WebView.processMouseEvent(WebView.java:366)
at javafx.scene.web.WebView.access$100(WebView.java:41)
at javafx.scene.web.WebView$2.handle(WebView.java:396)
at javafx.scene.web.WebView$2.handle(WebView.java:394)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:55)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchBubblingEvent(DefaultEventDispatcher.java:173)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchBubblingEvent(DefaultEventDispatcher.java:157)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:120)
at javafx.scene.Node$7.dispatchEvent(Node.java:3900)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:118)
at javafx.scene.Node$7.dispatchEvent(Node.java:3900)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.DefaultEventDispatcher.dispatchEvent(DefaultEventDispatcher.java:118)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventRedirector.dispatchEvent(EventRedirector.java:79)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at javafx.event.Event.fireEventImpl(Event.java:172)
at javafx.event.Event.fireEvent(Event.java:162)
at javafx.scene.Node.fireEvent(Node.java:4005)
at javafx.scene.Scene$MouseHandler.process(Scene.java:1913)
at javafx.scene.Scene$MouseHandler.process(Scene.java:1754)
at javafx.scene.Scene$MouseHandler.access$600(Scene.java:1726)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:883)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:1381)
at com.sun.javafx.tk.glass.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:91)
at com.sun.glass.ui.View.handleMouseEvent(View.java:259)
at com.sun.glass.ui.View.notifyMouse(View.java:498)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:14)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:33)
at java.lang.Thread.run(Thread.java:619)
Test app:
public class BrowserApp extends Application
{
public static void main(String[] pArgs)
{
Launcher.launch(BrowserApp.class, pArgs);
}
@Override
public void start(Stage pStage)
{
BorderPane bpane = new BorderPane();
WebEngine webe = new WebEngine();
webe.setUrl("http://www.sibvisions.com");
WebView webv = new WebView(webe);
webv.setPrefSize(500, 400);
bpane.setCenter(webv);
// bpane.setStyle("-fx-background-color: #888888;");
// Group group = new Group();
// group.getChildren().add(webv);
//
// Scene scene = new Scene(group);
Scene scene = new Scene(bpane);
pStage.setWidth(1000);
pStage.setHeight(500);
pStage.setScene(scene);
pStage.setVisible(true);
}
}