JavaSwingComponents: JScrollPane bugfix


JScrollPane bugfix

JScrollPane's support for synchronization between row/column headers and the main view is asymmetric. While it adjusts the headers if the position in the view changes, it doesn't do so if the headers' positions changed. This means that even a simple scrollRectToVisible call on a row/column header component will scroll the header, but not properly adjust the main view. This happens for example if you use a JTable as row header and the user selects by keyboard or by dragging, as then implicit scrolling happens. This is a known bug (#4202002).

Until that is fixed (3 years have already passed), the following class manually synchronizes the positions. I have found that it doesn't always work properly, when revalidation of the components is involved (i.e. size changes, like a JTable column being resized, are involved).

Source: JScrollPaneAdjuster.java


(C) 2001-2009 Christian Kaufhold (swing@chka.de)