1 /*
   2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt;
  27 
  28 import java.awt.event.*;
  29 
  30 import java.lang.annotation.Native;
  31 
  32 /**
  33  * The interface for objects which have an adjustable numeric value
  34  * contained within a bounded range of values.
  35  *
  36  * @author Amy Fowler
  37  * @author Tim Prinzing
  38  */
  39 public interface Adjustable {
  40 
  41     /**
  42      * Indicates that the <code>Adjustable</code> has horizontal orientation.
  43      */
  44     @Native public static final int HORIZONTAL = 0;
  45 
  46     /**
  47      * Indicates that the <code>Adjustable</code> has vertical orientation.
  48      */
  49     @Native public static final int VERTICAL = 1;
  50 
  51     /**
  52      * Indicates that the <code>Adjustable</code> has no orientation.
  53      */
  54     @Native public static final int NO_ORIENTATION = 2;
  55 
  56     /**
  57      * Gets the orientation of the adjustable object.
  58      * @return the orientation of the adjustable object;
  59      *   either <code>HORIZONTAL</code>, <code>VERTICAL</code>,
  60      *   or <code>NO_ORIENTATION</code>
  61      */
  62     int getOrientation();
  63 
  64     /**
  65      * Sets the minimum value of the adjustable object.
  66      * @param min the minimum value
  67      */
  68     void setMinimum(int min);
  69 
  70     /**
  71      * Gets the minimum value of the adjustable object.
  72      * @return the minimum value of the adjustable object
  73      */
  74     int getMinimum();
  75 
  76     /**
  77      * Sets the maximum value of the adjustable object.
  78      * @param max the maximum value
  79      */
  80     void setMaximum(int max);
  81 
  82     /**
  83      * Gets the maximum value of the adjustable object.
  84      * @return the maximum value of the adjustable object
  85      */
  86     int getMaximum();
  87 
  88     /**
  89      * Sets the unit value increment for the adjustable object.
  90      * @param u the unit increment
  91      */
  92     void setUnitIncrement(int u);
  93 
  94     /**
  95      * Gets the unit value increment for the adjustable object.
  96      * @return the unit value increment for the adjustable object
  97      */
  98     int getUnitIncrement();
  99 
 100     /**
 101      * Sets the block value increment for the adjustable object.
 102      * @param b the block increment
 103      */
 104     void setBlockIncrement(int b);
 105 
 106     /**
 107      * Gets the block value increment for the adjustable object.
 108      * @return the block value increment for the adjustable object
 109      */
 110     int getBlockIncrement();
 111 
 112     /**
 113      * Sets the length of the proportional indicator of the
 114      * adjustable object.
 115      * @param v the length of the indicator
 116      */
 117     void setVisibleAmount(int v);
 118 
 119     /**
 120      * Gets the length of the proportional indicator.
 121      * @return the length of the proportional indicator
 122      */
 123     int getVisibleAmount();
 124 
 125     /**
 126      * Sets the current value of the adjustable object. If
 127      * the value supplied is less than <code>minimum</code>
 128      * or greater than <code>maximum</code> - <code>visibleAmount</code>,
 129      * then one of those values is substituted, as appropriate.
 130      * <p>
 131      * Calling this method does not fire an
 132      * <code>AdjustmentEvent</code>.
 133      *
 134      * @param v the current value, between <code>minimum</code>
 135      *    and <code>maximum</code> - <code>visibleAmount</code>
 136      */
 137     void setValue(int v);
 138 
 139     /**
 140      * Gets the current value of the adjustable object.
 141      * @return the current value of the adjustable object
 142      */
 143     int getValue();
 144 
 145     /**
 146      * Adds a listener to receive adjustment events when the value of
 147      * the adjustable object changes.
 148      * @param l the listener to receive events
 149      * @see AdjustmentEvent
 150      */
 151     void addAdjustmentListener(AdjustmentListener l);
 152 
 153     /**
 154      * Removes an adjustment listener.
 155      * @param l the listener being removed
 156      * @see AdjustmentEvent
 157      */
 158     void removeAdjustmentListener(AdjustmentListener l);
 159 
 160 }