SUGGESTED FIX
------- Scrollbar.java -------
*** /tmp/sccs.NhaGti Sat Sep 20 14:25:14 2003
--- Scrollbar.java Sat Sep 20 14:25:07 2003
***************
*** 216,222 ****
/**
* The amount by which the scrollbar value will change when going
* up or down by a line.
! * This value should be a non negative integer.
*
* @serial
* @see #getLineIncrement
--- 216,222 ----
/**
* The amount by which the scrollbar value will change when going
* up or down by a line.
! * This value must be a positive integer.
*
* @serial
* @see #getLineIncrement
***************
*** 227,233 ****
/**
* The amount by which the scrollbar value will change when going
* up or down by a page.
! * This value should be a non negative integer.
*
* @serial
* @see #getPageIncrement
--- 227,233 ----
/**
* The amount by which the scrollbar value will change when going
* up or down by a page.
! * This value must be a positive integer.
*
* @serial
* @see #getPageIncrement
***************
*** 657,666 ****
/**
* Sets the unit increment for this scroll bar.
* <p>
! * The unit increment is the value that is added (subtracted)
* when the user activates the unit increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
*
* @param v the amount by which to increment or decrement
* the scroll bar's value
--- 657,669 ----
/**
* Sets the unit increment for this scroll bar.
* <p>
! * The unit increment is the value that is added or subtracted
* when the user activates the unit increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
+ * The unit increment must be a positive integer.
+ * Attepts to set the unit increment to a value lower than 1
+ * will result in a value of 1 being set.
*
* @param v the amount by which to increment or decrement
* the scroll bar's value
***************
*** 676,695 ****
* replaced by <code>setUnitIncrement(int)</code>.
*/
public synchronized void setLineIncrement(int v) {
! lineIncrement = v;
! ScrollbarPeer peer = (ScrollbarPeer)this.peer;
! if (peer != null) {
! peer.setLineIncrement(v);
! }
}
/**
* Gets the unit increment for this scrollbar.
* <p>
! * The unit increment is the value that is added (subtracted)
* when the user activates the unit increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
*
* @return the unit increment of this scroll bar
* @see java.awt.Scrollbar#setUnitIncrement
--- 679,705 ----
* replaced by <code>setUnitIncrement(int)</code>.
*/
public synchronized void setLineIncrement(int v) {
! int tmp = (v < 1) ? 1 : v;
!
! if (lineIncrement == tmp) {
! return;
! }
! lineIncrement = tmp;
!
! ScrollbarPeer peer = (ScrollbarPeer)this.peer;
! if (peer != null) {
! peer.setLineIncrement(lineIncrement);
! }
}
/**
* Gets the unit increment for this scrollbar.
* <p>
! * The unit increment is the value that is added or subtracted
* when the user activates the unit increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
+ * The unit increment must be a positive integer.
*
* @return the unit increment of this scroll bar
* @see java.awt.Scrollbar#setUnitIncrement
***************
*** 710,719 ****
/**
* Sets the block increment for this scroll bar.
* <p>
! * The block increment is the value that is added (subtracted)
* when the user activates the block increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
*
* @param v the amount by which to increment or decrement
* the scroll bar's value
--- 720,732 ----
/**
* Sets the block increment for this scroll bar.
* <p>
! * The block increment is the value that is added or subtracted
* when the user activates the block increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
+ * The block increment must be a positive integer.
+ * Attepts to set the block increment to a value lower than 1
+ * will result in a value of 1 being set.
*
* @param v the amount by which to increment or decrement
* the scroll bar's value
***************
*** 729,748 ****
* replaced by <code>setBlockIncrement()</code>.
*/
public synchronized void setPageIncrement(int v) {
! pageIncrement = v;
! ScrollbarPeer peer = (ScrollbarPeer)this.peer;
! if (peer != null) {
! peer.setPageIncrement(v);
! }
}
/**
* Gets the block increment of this scroll bar.
* <p>
! * The block increment is the value that is added (subtracted)
* when the user activates the block increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
*
* @return the block increment of this scroll bar
* @see java.awt.Scrollbar#setBlockIncrement
--- 742,768 ----
* replaced by <code>setBlockIncrement()</code>.
*/
public synchronized void setPageIncrement(int v) {
! int tmp = (v < 1) ? 1 : v;
!
! if (pageIncrement == tmp) {
! return;
! }
! pageIncrement = tmp;
!
! ScrollbarPeer peer = (ScrollbarPeer)this.peer;
! if (peer != null) {
! peer.setPageIncrement(pageIncrement);
! }
}
/**
* Gets the block increment of this scroll bar.
* <p>
! * The block increment is the value that is added or subtracted
* when the user activates the block increment area of the
* scroll bar, generally through a mouse or keyboard gesture
* that the scroll bar receives as an adjustment event.
+ * The block increment must be a positive integer.
*
* @return the block increment of this scroll bar
* @see java.awt.Scrollbar#setBlockIncrement
###@###.### 2003-09-24
|
EVALUATION
I disagree with this interpretation of the spec from the Description:
"If block/unit increment is negative, the scrollbar should decrement
its value when user tryes to increment it."
The increment is intended to be an absolute value, which is added to
the scrollbar value or subtracted from the scrollbar value.
Closing as "not a bug".
###@###.### 2002-04-30
We should update the specification to say that values less than 1 are not
meaningful. Since the underlying toolkit appears not to handle them correctly,
and our implementation has never been consistent, we should probably specify
and enforce 1 as a minimum value. That would give us cross-platform
compatibility and would be a good UI design as well. I doubt that anyone
would experience backwards compatibility problems.
Since this is a spec change, we should do it for Tiger.
###@###.### 2002-05-01
|