Reputation: 26179
I need to place a scroll bar to the left of the contents in my JScrollPane. Can it be done without a separate JScrollBar component? Perhaps simply by setting some alignment?
Upvotes: 12
Views: 6673
Reputation: 2782
Accepted answer gade my GridBagLayout
panel inability to stretch horizontally (and it seems there is more to it with components' preferred size bug #5727254)
I found solution for this:
leftPanelScroll.setRowHeaderView(leftPanelScroll.getVerticalScrollBar());
I hope it will help yet another poor soul.
Upvotes: 1
Reputation: 47
I tried changing the alignment of the track div from 'right' to 'left' in the css class .jspVerticalBar
. seems to work.
.jspVerticalBar
{
position: absolute;
top: 0;
left: 0;
width: 16px;
height: 100%;
background: red;
}
Upvotes: -4
Reputation: 26179
Using trial and error I found that
JScrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
worked like a charm.
Upvotes: 16