Reputation: 1061
I want to remove scroll bar from web view since i'm using web based scroll bar
Upvotes: 3
Views: 2271
Reputation: 2519
WebView manages scrolling automatically, so there is no need to put it into a ScrollPane
, therefore, You only need to do is control the CSS property overflow or the Webkit-Specify property -webkit-scrollbar
(WebView based on Webkit engine).
If you are load page from internet and not from disk, you can't control the CSS yourself, You can inject the css style as following code snippet.
final WebEngine engine = webView.getEngine();
engine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
@Override
public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
if (newValue == State.SUCCEEDED) {
String scriptCode = "customize javascript to inject style";
engine.executeScript(scriptCode);
}
}
});
Upvotes: 1