KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SScrollBar


1 /*
2  * $Id: SScrollBar.java,v 1.9 2005/05/26 13:18:08 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import org.wings.plaf.ScrollBarCG;
17
18 /**
19  * @author <a HREF="mailto:haaf@mercatis.de">Armin Haaf</a>
20  * @version $Revision: 1.9 $
21  */

22 public class SScrollBar
23         extends SAbstractAdjustable
24 {
25     boolean marginVisisble;
26     boolean stepVisisble;
27     boolean blockVisisble;
28
29     /**
30      * Creates a scrollbar with the specified orientation,
31      * value, extent, mimimum, and maximum.
32      * The "extent" is the size of the viewable area. It is also known
33      * as the "visible amount".
34      * <p/>
35      * Note: Use <code>setBlockIncrement</code> to set the block
36      * increment to a size slightly smaller than the view's extent.
37      * That way, when the user jumps the knob to an adjacent position,
38      * one or two lines of the original contents remain in view.
39      *
40      * @throws IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL
41      * @see #setOrientation
42      * @see #setValue
43      * @see #setVisibleAmount
44      * @see #setMinimum
45      * @see #setMaximum
46      */

47     public SScrollBar(int orientation, int value, int extent, int min, int max) {
48         super(value, extent, min, max);
49         setOrientation(orientation);
50     }
51
52     /**
53      * Creates a scrollbar with the specified orientation
54      * and the following initial values:
55      * <pre>
56      * minimum = 0
57      * maximum = 100
58      * value = 0
59      * extent = 10
60      * </pre>
61      */

62     public SScrollBar(int orientation) {
63         this(orientation, 0, 10, 0, 100);
64     }
65
66
67     /**
68      * Creates a vertical scrollbar with the following initial values:
69      * <pre>
70      * minimum = 0
71      * maximum = 100
72      * value = 0
73      * extent = 10
74      * </pre>
75      */

76     public SScrollBar() {
77         this(SConstants.VERTICAL);
78     }
79
80     public boolean isMarginVisisble() {
81         return marginVisisble;
82     }
83
84     public void setMarginVisisble(boolean marginVisisble) {
85         this.marginVisisble = marginVisisble;
86     }
87
88     public boolean isStepVisisble() {
89         return stepVisisble;
90     }
91
92     public void setStepVisisble(boolean stepVisisble) {
93         this.stepVisisble = stepVisisble;
94     }
95
96     public boolean isBlockVisisble() {
97         return blockVisisble;
98     }
99
100     public void setBlockVisisble(boolean blockVisisble) {
101         this.blockVisisble = blockVisisble;
102     }
103
104     public void setCG(ScrollBarCG cg) {
105         super.setCG(cg);
106     }
107
108     public String JavaDoc toString() {
109         return "SScrollBar[orientation=" + ((orientation == SConstants.HORIZONTAL) ? "horizontal" : "vertical") + "]";
110     }
111 }
112
Popular Tags