Contents

Swinging Duke
Feedback Button
Left ArrowRight Arrow

 

The Scrollbar API

 

This specification describes the Swing JScrollBar component, which is designed to be a source-compatible replacement for the Scrollbar component implemented in the existing AWT. (Two other Swing classes that support scrolling, JViewport and JScrollPane, are described in the specification titled "Support for Scrolling.")


Goals

The JScrollBar API that is offered in Swing mirrors the existing java.awt.Scrollbar API as closely as possible. It is intended to be a source compatible replacement for the java.awt.Scrollbar component. The underlying data model for this component is the BoundedRangeModel, which is responsible for enforcing the consistency of the values.


The JScrollBar API

This is the JScrollBar API:

public interface ScrollBarUI extends ComponentUI
{
}

public class JScrollBar extends JComponent implements Adjustable, ChangeListener
{
    public static final int VERTICAL = Adjustable.VERTICAL;
    public static final int HORIZONTAL = Adjustable.HORIZONTAL;

    public JScrollBar();
    public JScrollBar(int orientation);
    public JScrollBar(int orientation, int value, int visible,
                                        int minimum, int maximum)

    public int getOrientation();
    public int getMaximum();
    public int getMinimum();
    public int getValue();
    public int getVisibleAmount();
    public int getUnitIncrement(int direction);
    public int getBlockIncrement(int direction);
    
    public void setOrientation(int value);
    public void setMaximum(int value);
    public void setMinimum(int value);
    public void setVisibleAmount(int value);
    public void setUnitIncrement(int value);
    public void setBlockIncrement(int value);

    public synchronized void setValue(int value);
    public synchronized void setValues( int newValue, int newExtent,  
                                        int newMinimum,  int newMaximum);
                                        
    public void addAdjustmentListener(AdjustmentListener l);
    public void removeAdjustmentListener(AdjustmentListener l);
    
    public BoundedRangeModel getModel();
    public void setModel(BoundedRangeModel m);
    public ScrollBarUI getUI();
}


Notes for the JScrollBar Class

When you use the JScrollbar component, you should be aware of the following points.

Arrows


Version 0.5. Last modified 09/04/97.
Copyright © 1995-97 Sun Microsystems, Inc. All Rights Reserved.

Sun's Home Page