📄 jscrollpane.html
字号:
<!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:39:17 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class JScrollPane</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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JScrollPane.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/swing/JScrollBar.AccessibleJScrollBar.html"><B>PREV CLASS</B></A> <A HREF="../../javax/swing/JScrollPane.AccessibleJScrollPane.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> <A HREF="JScrollPane.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.swing</FONT><BR>Class JScrollPane</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../java/awt/Component.html">java.awt.Component</A> | +--<A HREF="../../java/awt/Container.html">java.awt.Container</A> | +--<A HREF="../../javax/swing/JComponent.html">javax.swing.JComponent</A> | +--<B>javax.swing.JScrollPane</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../javax/accessibility/Accessible.html">Accessible</A>, <A HREF="../../java/awt/image/ImageObserver.html">ImageObserver</A>, <A HREF="../../java/awt/MenuContainer.html">MenuContainer</A>, <A HREF="../../javax/swing/ScrollPaneConstants.html">ScrollPaneConstants</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public class <B>JScrollPane</B><DT>extends <A HREF="../../javax/swing/JComponent.html">JComponent</A><DT>implements <A HREF="../../javax/swing/ScrollPaneConstants.html">ScrollPaneConstants</A>, <A HREF="../../javax/accessibility/Accessible.html">Accessible</A></DL><P>Provides a scrollable view of a component. A <code>JScrollPane</code> manages a viewport, optional vertical and horizontal scroll bars, and optional row and column heading viewports. You can find task-oriented documentation of <code>JScrollPane</code> in <ahref="http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html">How to Use Scroll Panes</a>, a section in <em>The Java Tutorial</em>. <p> <TABLE ALIGN="RIGHT" BORDER="0"> <TR> <TD ALIGN="CENTER"> <P ALIGN="CENTER"><IMG SRC="doc-files/JScrollPane-1.gif" WIDTH="256" HEIGHT="248" ALIGN="BOTTOM" BORDER="0"> </TD> </TR> </TABLE> The <code>JViewport</code> provides a window, or "viewport" onto a data source -- for example, a text file. That data source is the "scrollable client" (aka data model) displayed by the <code>JViewport</code> view. A <code>JScrollPane</code> basically consists of <code>JScrollBar</code>s, a <code>JViewport</code>, and the wiring between them, as shown in the diagram at right. <p> In addition to the scroll bars and viewport, a <code>JScrollPane</code> can have a column header and a row header. Each of these is a <code>JViewport</code> object that you specify with <code>setRowHeaderView</code>, and <code>setColumnHeaderView</code>. The column header viewport automatically scrolls left and right, tracking the left-right scrolling of the main viewport. (It never scrolls vertically, however.) The row header acts in a similar fashion. <p> By default, the corners are empty. You can put a component into a corner using <code>setCorner</code>, in case you there is some function or decoration you would like to add to the scroll pane. The size of corner components is entirely determined by the size of the headers and scroll bars that surround them. <p> To add a border around the main viewport, you can use <code>setViewportBorder</code>. (Of course, you can also add a border around the whole scroll pane using <code>setBorder</code>.) <p> For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the <a href="doc-files/Key-Index.html#JScrollPane">JScrollPane</a> key assignments. <p> A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color of the viewport, via <code>scrollPane.getViewport().setBackground()</code>. The reason for setting the color of the viewport and not the scrollpane is that by default <code>JViewport</code> is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when <code>JScrollPane</code> draws its background the viewport will usually draw over it. <p> <strong>Warning:</strong>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -