The scrollbar ranges on Windows seem to be off. Given the following
range values: minimum = 0, maximum = 20, visible = 10... On Motif, the
scrollbar value ranges from the minimum to maximum-visible, as documented in
the Scrollbar.setValues() documentation. So, for the above values, the
scrollbar value can be scrolled from 0 to 10. On Windows, with the same
range, the scrollbar can only be scrolled from 0 to 1.
Sample Code:
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Scrollbar;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
public class scrollBarBug extends Applet implements AdjustmentListener
{
public void init()
{
Scrollbar scrollbar = new Scrollbar(Scrollbar.VERTICAL,
0, 10, 0, 20);
// Just setting layout so scrollbar thumb will be big enough to use
setLayout(new BorderLayout());
add("East", scrollbar);
scrollbar.addAdjustmentListener(this);
}
public void adjustmentValueChanged(AdjustmentEvent e)
{
System.out.println(e.paramString());
}
}
range values: minimum = 0, maximum = 20, visible = 10... On Motif, the
scrollbar value ranges from the minimum to maximum-visible, as documented in
the Scrollbar.setValues() documentation. So, for the above values, the
scrollbar value can be scrolled from 0 to 10. On Windows, with the same
range, the scrollbar can only be scrolled from 0 to 1.
Sample Code:
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Scrollbar;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
public class scrollBarBug extends Applet implements AdjustmentListener
{
public void init()
{
Scrollbar scrollbar = new Scrollbar(Scrollbar.VERTICAL,
0, 10, 0, 20);
// Just setting layout so scrollbar thumb will be big enough to use
setLayout(new BorderLayout());
add("East", scrollbar);
scrollbar.addAdjustmentListener(this);
}
public void adjustmentValueChanged(AdjustmentEvent e)
{
System.out.println(e.paramString());
}
}