Reputation: 11
Here is the code. I do not see the jxBrowser in the VBox. It creates it but does not display it. Does anyone know why this would be? Does JxBrowser allowed to be nested like this? VBox liveStream = new VBox(); liveStream.setSpacing(10);
//HBox Creation
HBox urlTextHolder = new HBox();
urlTextHolder.setSpacing(10);
urlTextHolder.setPadding(new Insets(1,5,5,5));
//Text Field and Button Creation (Removed this code because it is not relevant)
Browser browser = new Browser();
BrowserView browserView = new BrowserView(browser);
browser.loadHTML("<html><body><h1>Hello World!</h1></body></html>");
urlTextHolder.getChildren().addAll(url, urlSubmit);
liveStream.getChildren().addAll(urlTextHolder, browserView);
main.setLeft(liveStream);
//Scene WindowbrowserView
Scene scene = new Scene(main, 1920, 1080, Color.WHITE);
Stage mainPage= new Stage();
mainPage.setTitle("ILEC Live Stream Viewing");
mainPage.setScene(scene);
mainPage.show();
Upvotes: 0
Views: 187
Reputation: 438
You should build your JavaFX layout correctly. JavaFX BrowserView extends the StackPane. Therefore, if you invoke following code:
liveStream.getChildren().addAll(urlTextHolder, browserView);
VBox.setVgrow(browserView, Priority.ALWAYS);
and add the livestream
instance to the center of the main
:
BorderPane main = new BorderPane(liveStream);
the browser content should be successfully displayed.
Upvotes: 1