This patch (committed) modifies the setVisibleRowCount() method to fire the required
PropertyChangeEvent, and sets the correct default value for this property:
2006-06-26 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/JList.java
(init): Set default value for visibleRowCount to 8,
(setVisibleRowCount): Fire PropertyChangeEvent when value changes.
Regards,
Dave
Index: javax/swing/JList.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.57
diff -u -r1.57 JList.java
--- javax/swing/JList.java 26 Jun 2006 14:10:43 -0000 1.57
+++ javax/swing/JList.java 26 Jun 2006 14:46:03 -0000
@@ -1074,7 +1074,7 @@
fixedCellWidth = -1;
layoutOrientation = VERTICAL;
opaque = true;
- visibleRowCount = 7;
+ visibleRowCount = 8;
cellRenderer = new DefaultListCellRenderer();
listListener = new ListListener();
@@ -1184,11 +1184,13 @@
}
/**
- * Gets the value of the [EMAIL PROTECTED] #visibleRowCount} property.
+ * Gets the value of the [EMAIL PROTECTED] #visibleRowCount} property. The
default
+ * value is 8.
*
* @return the current value of the property.
+ *
+ * @see #setVisibleRowCount(int)
*/
-
public int getVisibleRowCount()
{
return visibleRowCount;
@@ -1198,12 +1200,19 @@
* Sets the value of the [EMAIL PROTECTED] #visibleRowCount} property.
*
* @param vc The new property value
+ *
+ * @see #getVisibleRowCount()
*/
public void setVisibleRowCount(int vc)
{
- visibleRowCount = vc;
- revalidate();
- repaint();
+ if (visibleRowCount != vc)
+ {
+ int oldValue = visibleRowCount;
+ visibleRowCount = Math.max(vc, 0);
+ firePropertyChange("visibleRowCount", oldValue, vc);
+ revalidate();
+ repaint();
+ }
}
/**