This is not so trivial, because, following the API, getScrollableUnitIncrement should also perform the rounding operation, completely exposing the subsequent item. I will think how to do this better.

Audrius.

Roman Kennke wrote:

Hi Audrius,

Am Montag, den 20.03.2006, 01:06 +0100 schrieb Audrius Meskauskas:
Surely, we can make via BasicScrollPaneUI and then have the JTrees scrolling with the wheel as well!

Wow, very nice!

However, I would not recommend to change the getScrollableUnitIncrement
methods. The units must stay the same (like one row for a JTable, one
line of text in JTextComponent and so on). This is because a single
click on a scollbar button scrolls the thing for exactly one unit. Only
the MouseWheelListener should multiply the unit by 3 to provide the
wheel scrolling behaviour of 3 lines per wheel move.

/Roman

2006-03-20  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax/swing/JTable.java (ROWS_PER_WHEEL_CLICK): New field.
   (getScrollableUnitIncrement): Rewritten.
   * javax/swing/JTree.java (ROWS_PER_WHEEL_CLICK): New field.
   (getScrollableUnitIncrement): Rewritten.
   (getScrollableBlockIncrement): Rewritten.
   * javax/swing/plaf/basic/BasicScrollPaneUI.java
(MouseWheelHandler): Implemented. (ViewportContainerListener): New class.
   (containerListener): New field. (SCROLL_NON_SCROLABLES): New field.
   (installListeners): Install wheel listeners. (uninstallListeners):
   Uninstall wheel listeners.
   * javax/swing/plaf/basic/BasicTableUI.java: Remove the implementation
   of the MouseWheelListener. (installListeners): Do not install wheel
   listener. (ROWS_PER_WHEEL_CLICK): Removed.


Reply via email to