Issue
I want to add padding to a WebView
in JavaFX, like you can add padding to a label.
I have already found this stack overflow discussion about WebView
on Android, and it has bugs with the padding. However, I want to add a WebView
in a BorderPane
on a desktop application with padding on all sides.
I tried to use setPadding()
however, this method doesn`t exist.
Is there an alternative for it?
Solution
As shown here, you can use the BorderPane
Optional Layout Constraints to add "Margin space around the outside of the child."
WebView webView = new WebView();
BorderPane.setMargin(webView, new Insets(16));
top.setCenter(webView);
Answered By - trashgod
Answer Checked By - Marilyn (JavaFixing Volunteer)