scrollbar.html

来自「API資料大全」· HTML 代码 · 共 1,165 行 · 第 1/5 页

HTML
1,165
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:33:00 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  Scrollbar</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Scrollbar.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/awt/Robot.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/awt/Scrollbar.AccessibleAWTScrollBar.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Scrollbar.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;<A HREF="#inner_class_summary">INNER</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.awt</FONT><BR>Class  Scrollbar</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../java/awt/Component.html">java.awt.Component</A>        |        +--<B>java.awt.Scrollbar</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../javax/accessibility/Accessible.html">Accessible</A>, <A HREF="../../java/awt/Adjustable.html">Adjustable</A>, <A HREF="../../java/awt/image/ImageObserver.html">ImageObserver</A>, <A HREF="../../java/awt/MenuContainer.html">MenuContainer</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public class <B>Scrollbar</B><DT>extends <A HREF="../../java/awt/Component.html">Component</A><DT>implements <A HREF="../../java/awt/Adjustable.html">Adjustable</A>, <A HREF="../../javax/accessibility/Accessible.html">Accessible</A></DL><P>The <code>Scrollbar</code> class embodies a scroll bar, a familiar user-interface object. A scroll bar provides a convenient means for allowing a user to select from a range of values. The following three vertical scroll bars could be used as slider controls to pick the red, green, and blue components of a color: <p> <img src="doc-files/Scrollbar-1.gif" ALIGN=center HSPACE=10 VSPACE=7> <p> Each scroll bar in this example could be created with code similar to the following: <p> <hr><blockquote><pre> redSlider=new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255); add(redSlider); </pre></blockquote><hr> <p> Alternatively, a scroll bar can represent a range of values. For example, if a scroll bar is used for scrolling through text, the width of the "bubble" or "thumb" can represent the amount of text that is visible. Here is an example of a scroll bar that represents a range: <p> <img src="doc-files/Scrollbar-2.gif" ALIGN=center HSPACE=10 VSPACE=7> <p> The value range represented by the bubble is the <em>visible</em> range of the scroll bar. The horizontal scroll bar in this example could be created with code like the following: <p> <hr><blockquote><pre> ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 60, 0, 300); add(ranger); </pre></blockquote><hr> <p> Note that the actual maximum value of the scroll bar is the <code>maximum</code> minus the <code>visible</code>. In the previous example, because the <code>maximum</code> is 300 and the <code>visible</code> is 60, the actual maximum value is 240.  The range of the scrollbar track is 0 - 300. The left side of the bubble indicates the value of the scroll bar. <p> Normally, the user changes the value of the scroll bar by making a gesture with the mouse. For example, the user can drag the scroll bar's bubble up and down, or click in the scroll bar's unit increment or block increment areas. Keyboard gestures can also be mapped to the scroll bar. By convention, the <b>Page&nbsp;Up</b> and <b>Page&nbsp;Down</b> keys are equivalent to clicking in the scroll bar's block increment and block decrement areas. <p> When the user changes the value of the scroll bar, the scroll bar receives an instance of <code>AdjustmentEvent</code>. The scroll bar processes this event, passing it along to any registered listeners. <p> Any object that wishes to be notified of changes to the scroll bar's value should implement <code>AdjustmentListener</code>, an interface defined in the package <code>java.awt.event</code>. Listeners can be added and removed dynamically by calling the methods <code>addAdjustmentListener</code> and <code>removeAdjustmentListener</code>. <p> The <code>AdjustmentEvent</code> class defines five types of adjustment event, listed here: <p> <ul> <li><code>AdjustmentEvent.TRACK</code> is sent out when the user drags the scroll bar's bubble. <li><code>AdjustmentEvent.UNIT_INCREMENT</code> is sent out when the user clicks in the left arrow of a horizontal scroll bar, or the top arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard. <li><code>AdjustmentEvent.UNIT_DECREMENT</code> is sent out when the user clicks in the right arrow of a horizontal scroll bar, or the bottom arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard. <li><code>AdjustmentEvent.BLOCK_INCREMENT</code> is sent out when the user clicks in the track, to the left of the bubble on a horizontal scroll bar, or above the bubble on a vertical scroll bar. By convention, the <b>Page&nbsp;Up</b> key is equivalent, if the user is using a keyboard that defines a <b>Page&nbsp;Up</b> key. <li><code>AdjustmentEvent.BLOCK_DECREMENT</code> is sent out when the user clicks in the track, to the right of the bubble on a horizontal scroll bar, or below the bubble on a vertical scroll bar. By convention, the <b>Page&nbsp;Down</b> key is equivalent, if the user is using a keyboard that defines a <b>Page&nbsp;Down</b> key. </ul> <p> The JDK&nbsp;1.0 event system is supported for backwards compatibility, but its use with newer versions of the platform is discouraged. The fives types of adjustment event introduced with JDK&nbsp;1.1 correspond to the five event types that are associated with scroll bars in previous platform versions. The following list gives the adjustment event type, and the corresponding JDK&nbsp;1.0 event type it replaces. <p> <ul> <li><code>AdjustmentEvent.TRACK</code> replaces <code>Event.SCROLL_ABSOLUTE</code> <li><code>AdjustmentEvent.UNIT_INCREMENT</code> replaces <code>Event.SCROLL_LINE_UP</code> <li><code>AdjustmentEvent.UNIT_DECREMENT</code> replaces <code>Event.SCROLL_LINE_DOWN</code> <li><code>AdjustmentEvent.BLOCK_INCREMENT</code> replaces <code>Event.SCROLL_PAGE_UP</code> <li><code>AdjustmentEvent.BLOCK_DECREMENT</code> replaces <code>Event.SCROLL_PAGE_DOWN</code> </ul> <p><P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/AdjustmentEvent.html"><CODE>AdjustmentEvent</CODE></A>, <A HREF="../../java/awt/event/AdjustmentListener.html"><CODE>AdjustmentListener</CODE></A>, <A HREF="../../serialized-form.html#java.awt.Scrollbar">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_class_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Inner Class Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Scrollbar.AccessibleAWTScrollBar.html">Scrollbar.AccessibleAWTScrollBar</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This class implements accessibility support for the  <code>Scrollbar</code> class.</TD></TR></TABLE>&nbsp;<A NAME="inner_classes_inherited_from_class_java.awt.Component"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class java.awt.<A HREF="../../java/awt/Component.html">Component</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/awt/Component.AccessibleAWTComponent.html">Component.AccessibleAWTComponent</A></CODE></TD></TR></TABLE>&nbsp;<!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?