JDK-6542335 : different behavior on knob of scroll bar between 1.4.2 and 5.0
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0u12
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-04-04
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
5.0u12Fixed 6u22-revFixed 7 b114Fixed
Related Reports
Relates :  
Relates :  
Description
Action for knob in scrol bar in 5.0ux is different from that in 1.4.2_14.

Configuration :
 JRE : 5.0u12-b02fcs
 OS  : WinXP(SP2, Japanese)
 Browser : IE6(SP2, Japanese)

REPRODUCE :
To place the attached files, JScrollBarTest.html, JScrollBarCom.class
and  under the same folder(directory)

---JRE5.0u12-b02---
 1) Open attached JScrollBarTest.html by double-clicking
   You will see 2 scroll bars.
 2) Click the knob on the scroll bar at right side.
   The knob moves to the left most position quickly. 
 3) Click the knob on the scroll bar at left side.
  The knob does not move.

---JRE1.4.2_14---
 1) Open attached JScrollBarTest.html by double-clicking
   You will see 2 scroll bars.
 2) Click the knob on the scroll bar at right side.
    The knob does not move. 
 3) Click the knob on the scroll bar at left side.
    The knob does not move

In the above steps, the action in 2) is different.

Comments
EVALUATION Test case: import java.awt.Dimension; import java.awt.Label; import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import javax.swing.*; public class JScrollBarCom extends JPanel { JScrollBar m_scrollbar; JScrollBar m_scrollbar2; Label m_label; Label m_label2; public JScrollBarCom() { m_scrollbar = new JScrollBar(0, 0, 1, 0, 1); m_scrollbar.setPreferredSize(new Dimension(200, 17)); m_scrollbar.setMaximum(100); m_scrollbar.setMinimum(0); m_scrollbar.setVisibleAmount(50); m_scrollbar.setValue(50); m_scrollbar2 = new JScrollBar(0, 0, 1, 0, 1); m_scrollbar2.setPreferredSize(new Dimension(200, 17)); DefaultBoundedRangeModel rangeModel = new DefaultBoundedRangeModel(); rangeModel.setMaximum(100); rangeModel.setMinimum(0); rangeModel.setExtent(50); rangeModel.setValue(50); m_scrollbar2.setModel(rangeModel); m_label = new Label("No use setModel()"); m_label2 = new Label("Use setModel()"); add(m_label); add(m_scrollbar); add(m_label2); add(m_scrollbar2); JButton test = new JButton("Test"); test.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { m_scrollbar2.setValueIsAdjusting(true); } }); add(test); } public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JScrollBarCom()); frame.setSize(200, 200); frame.setVisible(true); } }
09-04-2007

SUGGESTED FIX BasicScrollBarUI.java public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); if ("model" == propertyName) { BoundedRangeModel oldModel = (BoundedRangeModel)e.getOldValue(); BoundedRangeModel newModel = (BoundedRangeModel)e.getNewValue(); oldModel.removeChangeListener(modelListener); newModel.addChangeListener(modelListener); + scrollBarValue = scrollbar.getValue(); scrollbar.repaint(); scrollbar.revalidate();
09-04-2007

EVALUATION This is a real bug we have to update BasicScrollBarUI.scrollBarValue value when the model is changed
09-04-2007

EVALUATION Perhaps the submitter could provide source code?
05-04-2007