1 /*
2 * Copyright (c) 1995, 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
639 * visual representation of the relationship of the visible
640 * amount to the range of the scroll bar.
641 * Note that depending on platform, the value of the visible amount property
642 * may not be visually indicated by the size of the bubble.
643 * <p>
644 * The scroll bar's bubble may not be displayed when it is not
645 * moveable (e.g. when it takes up the entire length of the
646 * scroll bar's track, or when the scroll bar is disabled).
647 * Whether the bubble is displayed or not will not affect
648 * the value returned by <code>getVisibleAmount</code>.
649 *
650 * @return the visible amount of this scroll bar
651 * @see java.awt.Scrollbar#setVisibleAmount
652 * @since JDK1.1
653 */
654 public int getVisibleAmount() {
655 return getVisible();
656 }
657
658 /**
659 * @deprecated As of JDK version 1.1,
660 * replaced by <code>getVisibleAmount()</code>.
661 */
662 @Deprecated
663 public int getVisible() {
664 return visibleAmount;
665 }
666
667 /**
668 * Sets the visible amount of this scroll bar.
669 * <p>
670 * When a scroll bar is used to select a range of values,
671 * the visible amount is used to represent the range of values
672 * that are currently visible. The size of the scroll bar's
673 * bubble (also called a thumb or scroll box), usually gives a
674 * visual representation of the relationship of the visible
675 * amount to the range of the scroll bar.
676 * Note that depending on platform, the value of the visible amount property
677 * may not be visually indicated by the size of the bubble.
678 * <p>
712 * when the user activates the unit increment area of the
713 * scroll bar, generally through a mouse or keyboard gesture
714 * that the scroll bar receives as an adjustment event.
715 * The unit increment must be greater than zero.
716 * Attepts to set the unit increment to a value lower than 1
717 * will result in a value of 1 being set.
718 * <p>
719 * In some operating systems, this property
720 * can be ignored by the underlying controls.
721 *
722 * @param v the amount by which to increment or decrement
723 * the scroll bar's value
724 * @see java.awt.Scrollbar#getUnitIncrement
725 * @since JDK1.1
726 */
727 public void setUnitIncrement(int v) {
728 setLineIncrement(v);
729 }
730
731 /**
732 * @deprecated As of JDK version 1.1,
733 * replaced by <code>setUnitIncrement(int)</code>.
734 */
735 @Deprecated
736 public synchronized void setLineIncrement(int v) {
737 int tmp = (v < 1) ? 1 : v;
738
739 if (lineIncrement == tmp) {
740 return;
741 }
742 lineIncrement = tmp;
743
744 ScrollbarPeer peer = (ScrollbarPeer)this.peer;
745 if (peer != null) {
746 peer.setLineIncrement(lineIncrement);
747 }
748 }
749
750 /**
751 * Gets the unit increment for this scrollbar.
752 * <p>
753 * The unit increment is the value that is added or subtracted
754 * when the user activates the unit increment area of the
755 * scroll bar, generally through a mouse or keyboard gesture
756 * that the scroll bar receives as an adjustment event.
757 * The unit increment must be greater than zero.
758 * <p>
759 * In some operating systems, this property
760 * can be ignored by the underlying controls.
761 *
762 * @return the unit increment of this scroll bar
763 * @see java.awt.Scrollbar#setUnitIncrement
764 * @since JDK1.1
765 */
766 public int getUnitIncrement() {
767 return getLineIncrement();
768 }
769
770 /**
771 * @deprecated As of JDK version 1.1,
772 * replaced by <code>getUnitIncrement()</code>.
773 */
774 @Deprecated
775 public int getLineIncrement() {
776 return lineIncrement;
777 }
778
779 /**
780 * Sets the block increment for this scroll bar.
781 * <p>
782 * The block increment is the value that is added or subtracted
783 * when the user activates the block increment area of the
784 * scroll bar, generally through a mouse or keyboard gesture
785 * that the scroll bar receives as an adjustment event.
786 * The block increment must be greater than zero.
787 * Attepts to set the block increment to a value lower than 1
788 * will result in a value of 1 being set.
789 *
790 * @param v the amount by which to increment or decrement
791 * the scroll bar's value
792 * @see java.awt.Scrollbar#getBlockIncrement
793 * @since JDK1.1
794 */
795 public void setBlockIncrement(int v) {
796 setPageIncrement(v);
797 }
798
799 /**
800 * @deprecated As of JDK version 1.1,
801 * replaced by <code>setBlockIncrement()</code>.
802 */
803 @Deprecated
804 public synchronized void setPageIncrement(int v) {
805 int tmp = (v < 1) ? 1 : v;
806
807 if (pageIncrement == tmp) {
808 return;
809 }
810 pageIncrement = tmp;
811
812 ScrollbarPeer peer = (ScrollbarPeer)this.peer;
813 if (peer != null) {
814 peer.setPageIncrement(pageIncrement);
815 }
816 }
817
818 /**
819 * Gets the block increment of this scroll bar.
820 * <p>
821 * The block increment is the value that is added or subtracted
822 * when the user activates the block increment area of the
823 * scroll bar, generally through a mouse or keyboard gesture
824 * that the scroll bar receives as an adjustment event.
825 * The block increment must be greater than zero.
826 *
827 * @return the block increment of this scroll bar
828 * @see java.awt.Scrollbar#setBlockIncrement
829 * @since JDK1.1
830 */
831 public int getBlockIncrement() {
832 return getPageIncrement();
833 }
834
835 /**
836 * @deprecated As of JDK version 1.1,
837 * replaced by <code>getBlockIncrement()</code>.
838 */
839 @Deprecated
840 public int getPageIncrement() {
841 return pageIncrement;
842 }
843
844 /**
845 * Sets the values of four properties for this scroll bar:
846 * <code>value</code>, <code>visibleAmount</code>,
847 * <code>minimum</code>, and <code>maximum</code>.
848 * If the values supplied for these properties are inconsistent
849 * or incorrect, they will be changed to ensure consistency.
850 * <p>
851 * This method simultaneously and synchronously sets the values
852 * of four scroll bar properties, assuring that the values of
853 * these properties are mutually consistent. It enforces the
854 * following constraints:
855 * <code>maximum</code> must be greater than <code>minimum</code>,
|
1 /*
2 * Copyright (c) 1995, 2014, 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
639 * visual representation of the relationship of the visible
640 * amount to the range of the scroll bar.
641 * Note that depending on platform, the value of the visible amount property
642 * may not be visually indicated by the size of the bubble.
643 * <p>
644 * The scroll bar's bubble may not be displayed when it is not
645 * moveable (e.g. when it takes up the entire length of the
646 * scroll bar's track, or when the scroll bar is disabled).
647 * Whether the bubble is displayed or not will not affect
648 * the value returned by <code>getVisibleAmount</code>.
649 *
650 * @return the visible amount of this scroll bar
651 * @see java.awt.Scrollbar#setVisibleAmount
652 * @since JDK1.1
653 */
654 public int getVisibleAmount() {
655 return getVisible();
656 }
657
658 /**
659 * Returns the visible amount of this scroll bar.
660 *
661 * @return the visible amount of this scroll bar
662 * @deprecated As of JDK version 1.1,
663 * replaced by <code>getVisibleAmount()</code>.
664 */
665 @Deprecated
666 public int getVisible() {
667 return visibleAmount;
668 }
669
670 /**
671 * Sets the visible amount of this scroll bar.
672 * <p>
673 * When a scroll bar is used to select a range of values,
674 * the visible amount is used to represent the range of values
675 * that are currently visible. The size of the scroll bar's
676 * bubble (also called a thumb or scroll box), usually gives a
677 * visual representation of the relationship of the visible
678 * amount to the range of the scroll bar.
679 * Note that depending on platform, the value of the visible amount property
680 * may not be visually indicated by the size of the bubble.
681 * <p>
715 * when the user activates the unit increment area of the
716 * scroll bar, generally through a mouse or keyboard gesture
717 * that the scroll bar receives as an adjustment event.
718 * The unit increment must be greater than zero.
719 * Attepts to set the unit increment to a value lower than 1
720 * will result in a value of 1 being set.
721 * <p>
722 * In some operating systems, this property
723 * can be ignored by the underlying controls.
724 *
725 * @param v the amount by which to increment or decrement
726 * the scroll bar's value
727 * @see java.awt.Scrollbar#getUnitIncrement
728 * @since JDK1.1
729 */
730 public void setUnitIncrement(int v) {
731 setLineIncrement(v);
732 }
733
734 /**
735 * Sets the unit increment for this scroll bar.
736 *
737 * @param v the increment value
738 *
739 * @deprecated As of JDK version 1.1,
740 * replaced by <code>setUnitIncrement(int)</code>.
741 */
742 @Deprecated
743 public synchronized void setLineIncrement(int v) {
744 int tmp = (v < 1) ? 1 : v;
745
746 if (lineIncrement == tmp) {
747 return;
748 }
749 lineIncrement = tmp;
750
751 ScrollbarPeer peer = (ScrollbarPeer)this.peer;
752 if (peer != null) {
753 peer.setLineIncrement(lineIncrement);
754 }
755 }
756
757 /**
758 * Gets the unit increment for this scrollbar.
759 * <p>
760 * The unit increment is the value that is added or subtracted
761 * when the user activates the unit increment area of the
762 * scroll bar, generally through a mouse or keyboard gesture
763 * that the scroll bar receives as an adjustment event.
764 * The unit increment must be greater than zero.
765 * <p>
766 * In some operating systems, this property
767 * can be ignored by the underlying controls.
768 *
769 * @return the unit increment of this scroll bar
770 * @see java.awt.Scrollbar#setUnitIncrement
771 * @since JDK1.1
772 */
773 public int getUnitIncrement() {
774 return getLineIncrement();
775 }
776
777 /**
778 * Returns the unit increment for this scrollbar.
779 *
780 * @return the unit increment for this scrollbar
781 * @deprecated As of JDK version 1.1,
782 * replaced by <code>getUnitIncrement()</code>.
783 */
784 @Deprecated
785 public int getLineIncrement() {
786 return lineIncrement;
787 }
788
789 /**
790 * Sets the block increment for this scroll bar.
791 * <p>
792 * The block increment is the value that is added or subtracted
793 * when the user activates the block increment area of the
794 * scroll bar, generally through a mouse or keyboard gesture
795 * that the scroll bar receives as an adjustment event.
796 * The block increment must be greater than zero.
797 * Attepts to set the block increment to a value lower than 1
798 * will result in a value of 1 being set.
799 *
800 * @param v the amount by which to increment or decrement
801 * the scroll bar's value
802 * @see java.awt.Scrollbar#getBlockIncrement
803 * @since JDK1.1
804 */
805 public void setBlockIncrement(int v) {
806 setPageIncrement(v);
807 }
808
809 /**
810 * Sets the block increment for this scroll bar.
811 *
812 * @param v the block increment
813 * @deprecated As of JDK version 1.1,
814 * replaced by <code>setBlockIncrement()</code>.
815 */
816 @Deprecated
817 public synchronized void setPageIncrement(int v) {
818 int tmp = (v < 1) ? 1 : v;
819
820 if (pageIncrement == tmp) {
821 return;
822 }
823 pageIncrement = tmp;
824
825 ScrollbarPeer peer = (ScrollbarPeer)this.peer;
826 if (peer != null) {
827 peer.setPageIncrement(pageIncrement);
828 }
829 }
830
831 /**
832 * Gets the block increment of this scroll bar.
833 * <p>
834 * The block increment is the value that is added or subtracted
835 * when the user activates the block increment area of the
836 * scroll bar, generally through a mouse or keyboard gesture
837 * that the scroll bar receives as an adjustment event.
838 * The block increment must be greater than zero.
839 *
840 * @return the block increment of this scroll bar
841 * @see java.awt.Scrollbar#setBlockIncrement
842 * @since JDK1.1
843 */
844 public int getBlockIncrement() {
845 return getPageIncrement();
846 }
847
848 /**
849 * Returns the block increment of this scroll bar.
850 *
851 * @return the block increment of this scroll bar
852 *
853 * @deprecated As of JDK version 1.1,
854 * replaced by <code>getBlockIncrement()</code>.
855 */
856 @Deprecated
857 public int getPageIncrement() {
858 return pageIncrement;
859 }
860
861 /**
862 * Sets the values of four properties for this scroll bar:
863 * <code>value</code>, <code>visibleAmount</code>,
864 * <code>minimum</code>, and <code>maximum</code>.
865 * If the values supplied for these properties are inconsistent
866 * or incorrect, they will be changed to ensure consistency.
867 * <p>
868 * This method simultaneously and synchronously sets the values
869 * of four scroll bar properties, assuring that the values of
870 * these properties are mutually consistent. It enforces the
871 * following constraints:
872 * <code>maximum</code> must be greater than <code>minimum</code>,
|