Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I put the VERTICAL_SCROLLBAR at the left side of a JSCROLLPANE

Status
Not open for further replies.

180102

Programmer
Apr 8, 2003
1
BE
Hello,

I would like to put the VERTICAL SCROLLBAR at the left side of my JScrollPane. I tried to put it in the rowHeader like this :

...
JScrollPane myScroll = new JScrollPane();
myScroll.setRowHeaderView(myScroll.getVerticalScrollBar());
...

The Vertical ScrollBar appears to the left side but it doesn't work correctly. Can you help me please...

Thanks very much
 
Sorry to say that you may not be able to do it.

It seems that the location of the vertical scrollbar is tied to your Locale. If your java installation is defined as "Arabic", for instance (which reads right to left), then the scrollbar is put on the left. Changing your locale, though would affect a lot of other components too.

I was unable to successfully subclass ScrollPaneLayout to get around this. The behavior is pretty deeply hardwired. You could change and recompile the Swing classes themselves (there's a leftToRight boolean in ScrollPaneLayout). I can't imagine an application requirement important enough to make ME do it, though.

Your solution - making the vertical scrollbar the row header - doesn't work because the scrollbar itself gets scrolled up to keep aligned with the rows.

If you find a solution somewhere, please post it.


"When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top