1. /*
  2. * @(#)Adjustable.java 1.18 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt;
  8. import java.awt.event.*;
  9. /**
  10. * The interface for objects which have an adjustable numeric value
  11. * contained within a bounded range of values.
  12. *
  13. * @version 1.18 12/19/03
  14. * @author Amy Fowler
  15. * @author Tim Prinzing
  16. */
  17. public interface Adjustable {
  18. /**
  19. * Indicates that the <code>Adjustable</code> has horizontal orientation.
  20. */
  21. public static final int HORIZONTAL = 0;
  22. /**
  23. * Indicates that the <code>Adjustable</code> has vertical orientation.
  24. */
  25. public static final int VERTICAL = 1;
  26. /**
  27. * Indicates that the <code>Adjustable</code> has no orientation.
  28. */
  29. public static final int NO_ORIENTATION = 2;
  30. /**
  31. * Gets the orientation of the adjustable object.
  32. * @return the orientation of the adjustable object;
  33. * either <code>HORIZONTAL</code>, <code>VERTICAL</code>,
  34. * or <code>NO_ORIENTATION</code>
  35. */
  36. int getOrientation();
  37. /**
  38. * Sets the minimum value of the adjustable object.
  39. * @param min the minimum value
  40. */
  41. void setMinimum(int min);
  42. /**
  43. * Gets the minimum value of the adjustable object.
  44. * @return the minimum value of the adjustable object
  45. */
  46. int getMinimum();
  47. /**
  48. * Sets the maximum value of the adjustable object.
  49. * @param max the maximum value
  50. */
  51. void setMaximum(int max);
  52. /**
  53. * Gets the maximum value of the adjustable object.
  54. * @return the maximum value of the adjustable object
  55. */
  56. int getMaximum();
  57. /**
  58. * Sets the unit value increment for the adjustable object.
  59. * @param u the unit increment
  60. */
  61. void setUnitIncrement(int u);
  62. /**
  63. * Gets the unit value increment for the adjustable object.
  64. * @return the unit value increment for the adjustable object
  65. */
  66. int getUnitIncrement();
  67. /**
  68. * Sets the block value increment for the adjustable object.
  69. * @param b the block increment
  70. */
  71. void setBlockIncrement(int b);
  72. /**
  73. * Gets the block value increment for the adjustable object.
  74. * @return the block value increment for the adjustable object
  75. */
  76. int getBlockIncrement();
  77. /**
  78. * Sets the length of the proportional indicator of the
  79. * adjustable object.
  80. * @param v the length of the indicator
  81. */
  82. void setVisibleAmount(int v);
  83. /**
  84. * Gets the length of the proportional indicator.
  85. * @return the length of the proportional indicator
  86. */
  87. int getVisibleAmount();
  88. /**
  89. * Sets the current value of the adjustable object. If
  90. * the value supplied is less than <code>minimum</code>
  91. * or greater than <code>maximum</code> - <code>visibleAmount</code>,
  92. * then one of those values is substituted, as appropriate.
  93. * <p>
  94. * Calling this method does not fire an
  95. * <code>AdjustmentEvent</code>.
  96. *
  97. * @param v the current value, between <code>minimum</code>
  98. * and <code>maximum</code> - <code>visibleAmount</code>
  99. */
  100. void setValue(int v);
  101. /**
  102. * Gets the current value of the adjustable object.
  103. * @return the current value of the adjustable object
  104. */
  105. int getValue();
  106. /**
  107. * Adds a listener to receive adjustment events when the value of
  108. * the adjustable object changes.
  109. * @param l the listener to receive events
  110. * @see AdjustmentEvent
  111. */
  112. void addAdjustmentListener(AdjustmentListener l);
  113. /**
  114. * Removes an adjustment listener.
  115. * @param l the listener being removed
  116. * @see AdjustmentEvent
  117. */
  118. void removeAdjustmentListener(AdjustmentListener l);
  119. }