< prev index next >

src/java.desktop/share/classes/javax/swing/JScrollPane.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2015, 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


  40 import java.io.IOException;
  41 
  42 import java.beans.JavaBean;
  43 import java.beans.BeanProperty;
  44 import java.beans.PropertyChangeEvent;
  45 import java.beans.PropertyChangeListener;
  46 import java.beans.Transient;
  47 
  48 /**
  49  * Provides a scrollable view of a lightweight component.
  50  * A <code>JScrollPane</code> manages a viewport, optional
  51  * vertical and horizontal scroll bars, and optional row and
  52  * column heading viewports.
  53  * You can find task-oriented documentation of <code>JScrollPane</code> in
  54  *  <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html">How to Use Scroll Panes</a>,
  55  * a section in <em>The Java Tutorial</em>.  Note that
  56  * <code>JScrollPane</code> does not support heavyweight components.
  57  *
  58  * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
  59  *    <TR>
  60  *    <TD ALIGN="CENTER">
  61  *      <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JScrollPane-1.gif"
  62  *      alt="The following text describes this image."
  63  *      WIDTH="256" HEIGHT="248" STYLE="FLOAT:BOTTOM; BORDER:0px">
  64  *    </TD>
  65  *    </TR>
  66  * </TABLE>
  67  * The <code>JViewport</code> provides a window,
  68  * or &quot;viewport&quot; onto a data
  69  * source -- for example, a text file. That data source is the
  70  * &quot;scrollable client&quot; (aka data model) displayed by the
  71  * <code>JViewport</code> view.
  72  * A <code>JScrollPane</code> basically consists of <code>JScrollBar</code>s,
  73  * a <code>JViewport</code>, and the wiring between them,
  74  * as shown in the diagram at right.
  75  * <p>
  76  * In addition to the scroll bars and viewport,
  77  * a <code>JScrollPane</code> can have a
  78  * column header and a row header. Each of these is a
  79  * <code>JViewport</code> object that
  80  * you specify with <code>setRowHeaderView</code>,


   1 /*
   2  * Copyright (c) 1997, 2017, 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


  40 import java.io.IOException;
  41 
  42 import java.beans.JavaBean;
  43 import java.beans.BeanProperty;
  44 import java.beans.PropertyChangeEvent;
  45 import java.beans.PropertyChangeListener;
  46 import java.beans.Transient;
  47 
  48 /**
  49  * Provides a scrollable view of a lightweight component.
  50  * A <code>JScrollPane</code> manages a viewport, optional
  51  * vertical and horizontal scroll bars, and optional row and
  52  * column heading viewports.
  53  * You can find task-oriented documentation of <code>JScrollPane</code> in
  54  *  <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html">How to Use Scroll Panes</a>,
  55  * a section in <em>The Java Tutorial</em>.  Note that
  56  * <code>JScrollPane</code> does not support heavyweight components.
  57  *
  58  * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
  59  *    <TR>
  60  *    <TD style="text-align:center">
  61  *      <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JScrollPane-1.gif"
  62  *      alt="The following text describes this image."
  63  *      WIDTH="256" HEIGHT="248" STYLE="FLOAT:BOTTOM; BORDER:0px">
  64  *    </TD>
  65  *    </TR>
  66  * </TABLE>
  67  * The <code>JViewport</code> provides a window,
  68  * or &quot;viewport&quot; onto a data
  69  * source -- for example, a text file. That data source is the
  70  * &quot;scrollable client&quot; (aka data model) displayed by the
  71  * <code>JViewport</code> view.
  72  * A <code>JScrollPane</code> basically consists of <code>JScrollBar</code>s,
  73  * a <code>JViewport</code>, and the wiring between them,
  74  * as shown in the diagram at right.
  75  * <p>
  76  * In addition to the scroll bars and viewport,
  77  * a <code>JScrollPane</code> can have a
  78  * column header and a row header. Each of these is a
  79  * <code>JViewport</code> object that
  80  * you specify with <code>setRowHeaderView</code>,


< prev index next >