J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package java.awt; |
| 27 | |
| 28 | import java.awt.event.*; |
| 29 | |
| 30 | /** |
| 31 | * The interface for objects which have an adjustable numeric value |
| 32 | * contained within a bounded range of values. |
| 33 | * |
| 34 | * @author Amy Fowler |
| 35 | * @author Tim Prinzing |
| 36 | */ |
| 37 | |
| 38 | public interface Adjustable { |
| 39 | |
| 40 | /** |
| 41 | * Indicates that the <code>Adjustable</code> has horizontal orientation. |
| 42 | */ |
| 43 | public static final int HORIZONTAL = 0; |
| 44 | |
| 45 | /** |
| 46 | * Indicates that the <code>Adjustable</code> has vertical orientation. |
| 47 | */ |
| 48 | public static final int VERTICAL = 1; |
| 49 | |
| 50 | /** |
| 51 | * Indicates that the <code>Adjustable</code> has no orientation. |
| 52 | */ |
| 53 | public static final int NO_ORIENTATION = 2; |
| 54 | |
| 55 | /** |
| 56 | * Gets the orientation of the adjustable object. |
| 57 | * @return the orientation of the adjustable object; |
| 58 | * either <code>HORIZONTAL</code>, <code>VERTICAL</code>, |
| 59 | * or <code>NO_ORIENTATION</code> |
| 60 | */ |
| 61 | int getOrientation(); |
| 62 | |
| 63 | /** |
| 64 | * Sets the minimum value of the adjustable object. |
| 65 | * @param min the minimum value |
| 66 | */ |
| 67 | void setMinimum(int min); |
| 68 | |
| 69 | /** |
| 70 | * Gets the minimum value of the adjustable object. |
| 71 | * @return the minimum value of the adjustable object |
| 72 | */ |
| 73 | int getMinimum(); |
| 74 | |
| 75 | /** |
| 76 | * Sets the maximum value of the adjustable object. |
| 77 | * @param max the maximum value |
| 78 | */ |
| 79 | void setMaximum(int max); |
| 80 | |
| 81 | /** |
| 82 | * Gets the maximum value of the adjustable object. |
| 83 | * @return the maximum value of the adjustable object |
| 84 | */ |
| 85 | int getMaximum(); |
| 86 | |
| 87 | /** |
| 88 | * Sets the unit value increment for the adjustable object. |
| 89 | * @param u the unit increment |
| 90 | */ |
| 91 | void setUnitIncrement(int u); |
| 92 | |
| 93 | /** |
| 94 | * Gets the unit value increment for the adjustable object. |
| 95 | * @return the unit value increment for the adjustable object |
| 96 | */ |
| 97 | int getUnitIncrement(); |
| 98 | |
| 99 | /** |
| 100 | * Sets the block value increment for the adjustable object. |
| 101 | * @param b the block increment |
| 102 | */ |
| 103 | void setBlockIncrement(int b); |
| 104 | |
| 105 | /** |
| 106 | * Gets the block value increment for the adjustable object. |
| 107 | * @return the block value increment for the adjustable object |
| 108 | */ |
| 109 | int getBlockIncrement(); |
| 110 | |
| 111 | /** |
| 112 | * Sets the length of the proportional indicator of the |
| 113 | * adjustable object. |
| 114 | * @param v the length of the indicator |
| 115 | */ |
| 116 | void setVisibleAmount(int v); |
| 117 | |
| 118 | /** |
| 119 | * Gets the length of the proportional indicator. |
| 120 | * @return the length of the proportional indicator |
| 121 | */ |
| 122 | int getVisibleAmount(); |
| 123 | |
| 124 | /** |
| 125 | * Sets the current value of the adjustable object. If |
| 126 | * the value supplied is less than <code>minimum</code> |
| 127 | * or greater than <code>maximum</code> - <code>visibleAmount</code>, |
| 128 | * then one of those values is substituted, as appropriate. |
| 129 | * <p> |
| 130 | * Calling this method does not fire an |
| 131 | * <code>AdjustmentEvent</code>. |
| 132 | * |
| 133 | * @param v the current value, between <code>minimum</code> |
| 134 | * and <code>maximum</code> - <code>visibleAmount</code> |
| 135 | */ |
| 136 | void setValue(int v); |
| 137 | |
| 138 | /** |
| 139 | * Gets the current value of the adjustable object. |
| 140 | * @return the current value of the adjustable object |
| 141 | */ |
| 142 | int getValue(); |
| 143 | |
| 144 | /** |
| 145 | * Adds a listener to receive adjustment events when the value of |
| 146 | * the adjustable object changes. |
| 147 | * @param l the listener to receive events |
| 148 | * @see AdjustmentEvent |
| 149 | */ |
| 150 | void addAdjustmentListener(AdjustmentListener l); |
| 151 | |
| 152 | /** |
| 153 | * Removes an adjustment listener. |
| 154 | * @param l the listener being removed |
| 155 | * @see AdjustmentEvent |
| 156 | */ |
| 157 | void removeAdjustmentListener(AdjustmentListener l); |
| 158 | |
| 159 | } |