Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable horizontal scrolling in ScrollBar (JavaFX)?

I disabled showing the horizontal ScrollBar with following code:

scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

It's no longer visible, but usuable with the mouse wheel. How can I prevent that?

There's a ScrollPane with vertical ScrollBar. But I can click the mouse wheel to right and the content is scrolling horizontal.

Thanks.

like image 291
cy221 Avatar asked May 22 '15 07:05

cy221


People also ask

How do I turn off horizontal scrolling in Java?

Just set the display to "none" using the CSS class for the horizontal bar. At the bottom of your jScrollPlane (after you've initialized it), add in: $('. jspHorizontalBar').

What causes horizontal scrollbar?

Web browsers do not take into account the width of the scrollbar on the side of a page when computing width values, so since we have a page that is longer than a single viewport, part of our page is being rendered behind the vertical scroll bar, causing the browser to display a horizontal scroll bar.

What is a scroll pane JavaFX?

The ScrollPane allows the application to set the current, minimum, and maximum values for positioning the contents in the horizontal and vertical directions. These values are mapped proportionally onto the layoutBounds of the contained node.


Video Answer


1 Answers

I believe this is the proper way:

sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
like image 120
neilnm Avatar answered Oct 22 '22 16:10

neilnm