From ed965a01d8392b63a57ff52b5e707bba253c32d2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 03 Nov 2009 16:58:43 +0000
Subject: [PATCH] Fix for issue 4335 (Scroll wheel in Control Panel is waaay too slow) Increase the value of the unit increment in the scroll panes used by the control panel.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java |    3 ++-
 opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java           |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
index 0e61917..7cdff08 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.guitools.controlpanel.ui;
@@ -85,6 +85,7 @@
     try
     {
       JScrollPane scroll = new JScrollPane();
+      Utilities.setScrollIncrementUnit(scroll);
       border = scroll.getBorder();
       // If the border is of class MetalBorders$ScrollPaneBorder it cannot
       // be used.
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index ce49ef8..de1c88c 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -402,6 +402,7 @@
     scroll.getViewport().setOpaque(false);
     scroll.getViewport().setBackground(ColorAndFontConstants.background);
     scroll.setBackground(ColorAndFontConstants.background);
+    setScrollIncrementUnit(scroll);
     return scroll;
   }
 
@@ -417,10 +418,24 @@
     scroll.setOpaque(false);
     scroll.getViewport().setBackground(ColorAndFontConstants.background);
     scroll.setBackground(ColorAndFontConstants.background);
+    setScrollIncrementUnit(scroll);
     return scroll;
   }
 
   /**
+   * Sets the scroll increment unit for the scroll.
+   * @param scroll the scroll to be updated.
+   */
+  public static void setScrollIncrementUnit(JScrollPane scroll)
+  {
+    if (scroll.getVerticalScrollBar() != null)
+    {
+      int increment = scroll.getVerticalScrollBar().getUnitIncrement();
+      scroll.getVerticalScrollBar().setUnitIncrement(increment * 3);
+    }
+  }
+
+  /**
    * Creates a button.
    * @param text the message to be displayed by the button.
    * @return the created button.

--
Gitblit v1.10.0