This patch (committed) reimplements the paramString() method in JSlider to provide better debugging information:

2006-04-18  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/JSlider.java
        (paramString): Reimplemented.

Note that I followed the format of the reference implementation for the output, even though this is not strictly required by the spec. The last entry for JSlider (",snapToValue=true") is odd since there is no snapToValue attribute (unless I missed it) so for now I have just added it to the output always set to true. If anyone knows where the value should come from, please say...

Regards,

Dave
Index: javax/swing/JSlider.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JSlider.java,v
retrieving revision 1.26
diff -u -r1.26 JSlider.java
--- javax/swing/JSlider.java    29 Mar 2006 21:26:11 -0000      1.26
+++ javax/swing/JSlider.java    18 Apr 2006 16:38:40 -0000
@@ -1068,15 +1068,35 @@
   }
 
   /**
-   * Returns a string describing the attributes of this slider, for debugging
-   * purposes.  According to the specification, this method is implementation 
-   * specific, we just return "JSlider" at present.
+   * Returns an implementation-dependent string describing the attributes of
+   * this <code>JComboBox</code>.
    *
-   * @return Returns a string describing the attributes of this slider.
+   * @return A string describing the attributes of this <code>JComboBox</code>
+   *         (never <code>null</code>).
    */
   protected String paramString()
   {
-    return "JSlider";
+    String superParamStr = super.paramString();
+    StringBuffer sb = new StringBuffer();
+    sb.append(",isInverted=").append(getInverted());
+    sb.append(",majorTickSpacing=").append(getMajorTickSpacing());
+    sb.append(",minorTickSpacing=").append(getMinorTickSpacing());
+    sb.append(",orientation=");
+    if (orientation == HORIZONTAL)
+      sb.append("HORIZONTAL");
+    else
+      sb.append("VERTICAL");
+    sb.append(",paintLabels=").append(getPaintLabels());
+    sb.append(",paintTicks=").append(getPaintTicks());
+    sb.append(",paintTrack=").append(getPaintTrack());
+    sb.append(",snapToTicks=").append(getSnapToTicks());
+    
+    // the following is output by the reference implementation.  We don't
+    // strictly need to replicate this. Perhaps it has some meaning, but
+    // I couldn't determine it yet...
+    sb.append(",snapToValue=true");
+
+    return superParamStr + sb.toString();
   }
 
   /**

Reply via email to