Java Doc for JScrollPane.java in  » 6.0-JDK-Core » swing » javax » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.JComponent
   javax.swing.JScrollPane

JScrollPane
public class JScrollPane extends JComponent implements ScrollPaneConstants,Accessible(Code)
Provides a scrollable view of a lightweight component. A JScrollPane manages a viewport, optional vertical and horizontal scroll bars, and optional row and column heading viewports. You can find task-oriented documentation of JScrollPane in How to Use Scroll Panes, a section in The Java Tutorial. Note that JScrollPane does not support heavyweight components.

The following text describes this image.

The JViewport 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 JViewport view. A JScrollPane basically consists of JScrollBars, a JViewport, and the wiring between them, as shown in the diagram at right.

In addition to the scroll bars and viewport, a JScrollPane can have a column header and a row header. Each of these is a JViewport object that you specify with setRowHeaderView, and setColumnHeaderView. 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.

Where two scroll bars meet, the row header meets the column header, or a scroll bar meets one of the headers, both components stop short of the corner, leaving a rectangular space which is, by default, empty. These spaces can potentially exist in any number of the four corners. In the previous diagram, the top right space is present and identified by the label "corner component".

Any number of these empty spaces can be replaced by using the setCorner method to add a component to a particular corner. (Note: The same component cannot be added to multiple corners.) This is useful if there's some extra decoration or function you'd like to add to the scroll pane. The size of each corner component is entirely determined by the size of the headers and/or scroll bars that surround it.

A corner component will only be visible if there is an empty space in that corner for it to exist in. For example, consider a component set into the top right corner of a scroll pane with a column header. If the scroll pane's vertical scrollbar is not present, perhaps because the view component hasn't grown large enough to require it, then the corner component will not be shown (since there is no empty space in that corner created by the meeting of the header and vertical scroll bar). Forcing the scroll bar to always be shown, using setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS), will ensure that the space for the corner component always exists.

To add a border around the main viewport, you can use setViewportBorder. (Of course, you can also add a border around the whole scroll pane using setBorder.)

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 scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.

By default JScrollPane uses ScrollPaneLayout to handle the layout of its child Components. ScrollPaneLayout determines the size to make the viewport view in one of two ways:

  1. If the view implements Scrollable a combination of getPreferredScrollableViewportSize, getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used, otherwise
  2. getPreferredSize is used.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .
See Also:   JScrollBar
See Also:   JViewport
See Also:   ScrollPaneLayout
See Also:   Scrollable
See Also:   Component.getPreferredSize
See Also:   JScrollPane.setViewportView
See Also:   JScrollPane.setRowHeaderView
See Also:   JScrollPane.setColumnHeaderView
See Also:   JScrollPane.setCorner
See Also:   JScrollPane.setViewportBorder
version:
   1.116 @(#)JScrollPane.java 1.116
author:
   Hans Muller


Inner Class :protected class ScrollBar extends JScrollBar implements UIResource
Inner Class :protected class AccessibleJScrollPane extends AccessibleJComponent implements ChangeListener,PropertyChangeListener

Field Summary
protected  JViewportcolumnHeader
     The column header child.
protected  JScrollBarhorizontalScrollBar
     The scrollpane's horizontal scrollbar child.
protected  inthorizontalScrollBarPolicy
     The display policy for the horizontal scrollbar.
protected  ComponentlowerLeft
     The component to display in the lower left corner.
protected  ComponentlowerRight
     The component to display in the lower right corner.
protected  JViewportrowHeader
     The row header child.
protected  ComponentupperLeft
     The component to display in the upper left corner.
protected  ComponentupperRight
     The component to display in the upper right corner.
protected  JScrollBarverticalScrollBar
     The scrollpane's vertical scrollbar child.
protected  intverticalScrollBarPolicy
     The display policy for the vertical scrollbar.
protected  JViewportviewport
     The scrollpane's viewport child.

Constructor Summary
public  JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
     Creates a JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if vsbPolicy is VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically.
public  JScrollPane(Component view)
     Creates a JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
public  JScrollPane(int vsbPolicy, int hsbPolicy)
     Creates an empty (no viewport view) JScrollPane with specified scrollbar policies.
public  JScrollPane()
     Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed.

Method Summary
public  JScrollBarcreateHorizontalScrollBar()
     Returns a JScrollPane.ScrollBar by default.
public  JScrollBarcreateVerticalScrollBar()
     Returns a JScrollPane.ScrollBar by default.
protected  JViewportcreateViewport()
     Returns a new JViewport by default.
public  AccessibleContextgetAccessibleContext()
     Gets the AccessibleContext associated with this JScrollPane.
public  JViewportgetColumnHeader()
     Returns the column header.
public  ComponentgetCorner(String key)
     Returns the component at the specified corner.
public  JScrollBargetHorizontalScrollBar()
     Returns the horizontal scroll bar that controls the viewport's horizontal view position.
public  intgetHorizontalScrollBarPolicy()
     Returns the horizontal scroll bar policy value.
public  JViewportgetRowHeader()
     Returns the row header.
public  ScrollPaneUIgetUI()
     Returns the look and feel (L&F) object that renders this component.
public  StringgetUIClassID()
     Returns the suffix used to construct the name of the L&F class used to render this component.
public  JScrollBargetVerticalScrollBar()
     Returns the vertical scroll bar that controls the viewports vertical view position.
public  intgetVerticalScrollBarPolicy()
     Returns the vertical scroll bar policy value.
public  JViewportgetViewport()
     Returns the current JViewport.
public  BordergetViewportBorder()
     Returns the Border object that surrounds the viewport.
public  RectanglegetViewportBorderBounds()
     Returns the bounds of the viewport's border.
public  booleanisValidateRoot()
     Overridden to return true so that any calls to revalidate on any descendants of this JScrollPane will cause the entire tree beginning with this JScrollPane to be validated.
public  booleanisWheelScrollingEnabled()
     Indicates whether or not scrolling will take place in response to the mouse wheel.
protected  StringparamString()
     Returns a string representation of this JScrollPane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations.
public  voidsetColumnHeader(JViewport columnHeader)
     Removes the old columnHeader, if it exists; if the new columnHeader isn't null, syncs the x coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
public  voidsetColumnHeaderView(Component view)
     Creates a column-header viewport if necessary, sets its view, and then adds the column-header viewport to the scrollpane.
public  voidsetComponentOrientation(ComponentOrientation co)
     Sets the orientation for the vertical and horizontal scrollbars as determined by the ComponentOrientation argument.
public  voidsetCorner(String key, Component corner)
     Adds a child that will appear in one of the scroll panes corners, if there's room.
public  voidsetHorizontalScrollBar(JScrollBar horizontalScrollBar)
     Adds the scrollbar that controls the viewport's horizontal view position to the scrollpane.
public  voidsetHorizontalScrollBarPolicy(int policy)
     Determines when the horizontal scrollbar appears in the scrollpane.
public  voidsetLayout(LayoutManager layout)
     Sets the layout manager for this JScrollPane. This method overrides setLayout in java.awt.Container to ensure that only LayoutManagers which are subclasses of ScrollPaneLayout can be used in a JScrollPane.
public  voidsetRowHeader(JViewport rowHeader)
     Removes the old rowHeader, if it exists; if the new rowHeader isn't null, syncs the y coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
public  voidsetRowHeaderView(Component view)
     Creates a row-header viewport if necessary, sets its view and then adds the row-header viewport to the scrollpane.
public  voidsetUI(ScrollPaneUI ui)
     Sets the ScrollPaneUI object that provides the look and feel (L&F) for this component.
public  voidsetVerticalScrollBar(JScrollBar verticalScrollBar)
     Adds the scrollbar that controls the viewports vertical view position to the scrollpane.
public  voidsetVerticalScrollBarPolicy(int policy)
     Determines when the vertical scrollbar appears in the scrollpane.
public  voidsetViewport(JViewport viewport)
     Removes the old viewport (if there is one); forces the viewPosition of the new viewport to be in the +x,+y quadrant; syncs up the row and column headers (if there are any) with the new viewport; and finally syncs the scrollbars and headers with the new viewport.
public  voidsetViewportBorder(Border viewportBorder)
     Adds a border around the viewport.
public  voidsetViewportView(Component view)
     Creates a viewport if necessary and then sets its view.
public  voidsetWheelScrollingEnabled(boolean handleWheel)
     Enables/disables scrolling in response to movement of the mouse wheel.
public  voidupdateUI()
     Replaces the current ScrollPaneUI object with a version from the current default look and feel.

Field Detail
columnHeader
protected JViewport columnHeader(Code)
The column header child. Default is null.
See Also:   JScrollPane.setColumnHeader



horizontalScrollBar
protected JScrollBar horizontalScrollBar(Code)
The scrollpane's horizontal scrollbar child. Default is a JScrollBar.
See Also:   JScrollPane.setHorizontalScrollBar



horizontalScrollBarPolicy
protected int horizontalScrollBarPolicy(Code)
The display policy for the horizontal scrollbar. The default is ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED.
See Also:   JScrollPane.setHorizontalScrollBarPolicy



lowerLeft
protected Component lowerLeft(Code)
The component to display in the lower left corner. Default is null.
See Also:   JScrollPane.setCorner



lowerRight
protected Component lowerRight(Code)
The component to display in the lower right corner. Default is null.
See Also:   JScrollPane.setCorner



rowHeader
protected JViewport rowHeader(Code)
The row header child. Default is null.
See Also:   JScrollPane.setRowHeader



upperLeft
protected Component upperLeft(Code)
The component to display in the upper left corner. Default is null.
See Also:   JScrollPane.setCorner



upperRight
protected Component upperRight(Code)
The component to display in the upper right corner. Default is null.
See Also:   JScrollPane.setCorner



verticalScrollBar
protected JScrollBar verticalScrollBar(Code)
The scrollpane's vertical scrollbar child. Default is a JScrollBar.
See Also:   JScrollPane.setVerticalScrollBar



verticalScrollBarPolicy
protected int verticalScrollBarPolicy(Code)
The display policy for the vertical scrollbar. The default is ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED.
See Also:   JScrollPane.setVerticalScrollBarPolicy



viewport
protected JViewport viewport(Code)
The scrollpane's viewport child. Default is an empty JViewport.
See Also:   JScrollPane.setViewport




Constructor Detail
JScrollPane
public JScrollPane(Component view, int vsbPolicy, int hsbPolicy)(Code)
Creates a JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if vsbPolicy is VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy and JScrollPane.setHorizontalScrollBarPolicy .
See Also:   JScrollPane.setViewportView
Parameters:
  view - the component to display in the scrollpanes viewport
Parameters:
  vsbPolicy - an integer that specifies the verticalscrollbar policy
Parameters:
  hsbPolicy - an integer that specifies the horizontalscrollbar policy



JScrollPane
public JScrollPane(Component view)(Code)
Creates a JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
See Also:   JScrollPane.setViewportView
Parameters:
  view - the component to display in the scrollpane's viewport



JScrollPane
public JScrollPane(int vsbPolicy, int hsbPolicy)(Code)
Creates an empty (no viewport view) JScrollPane with specified scrollbar policies. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy and JScrollPane.setHorizontalScrollBarPolicy .
See Also:   JScrollPane.setViewportView
Parameters:
  vsbPolicy - an integer that specifies the verticalscrollbar policy
Parameters:
  hsbPolicy - an integer that specifies the horizontalscrollbar policy



JScrollPane
public JScrollPane()(Code)
Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed.




Method Detail
createHorizontalScrollBar
public JScrollBar createHorizontalScrollBar()(Code)
Returns a JScrollPane.ScrollBar by default. Subclasses may override this method to force ScrollPaneUI implementations to use a JScrollBar subclass. Used by ScrollPaneUI implementations to create the horizontal scrollbar. a JScrollBar with a horizontal orientation
See Also:   JScrollBar



createVerticalScrollBar
public JScrollBar createVerticalScrollBar()(Code)
Returns a JScrollPane.ScrollBar by default. Subclasses may override this method to force ScrollPaneUI implementations to use a JScrollBar subclass. Used by ScrollPaneUI implementations to create the vertical scrollbar. a JScrollBar with a vertical orientation
See Also:   JScrollBar



createViewport
protected JViewport createViewport()(Code)
Returns a new JViewport by default. Used to create the viewport (as needed) in setViewportView, setRowHeaderView, and setColumnHeaderView. Subclasses may override this method to return a subclass of JViewport. a new JViewport



getAccessibleContext
public AccessibleContext getAccessibleContext()(Code)
Gets the AccessibleContext associated with this JScrollPane. For scroll panes, the AccessibleContext takes the form of an AccessibleJScrollPane. A new AccessibleJScrollPane instance is created if necessary. an AccessibleJScrollPane that serves as the AccessibleContext of this JScrollPane



getColumnHeader
public JViewport getColumnHeader()(Code)
Returns the column header. the columnHeader property
See Also:   JScrollPane.setColumnHeader



getCorner
public Component getCorner(String key)(Code)
Returns the component at the specified corner. The key value specifying the corner is one of:
  • ScrollPaneConstants.LOWER_LEFT_CORNER
  • ScrollPaneConstants.LOWER_RIGHT_CORNER
  • ScrollPaneConstants.UPPER_LEFT_CORNER
  • ScrollPaneConstants.UPPER_RIGHT_CORNER
  • ScrollPaneConstants.LOWER_LEADING_CORNER
  • ScrollPaneConstants.LOWER_TRAILING_CORNER
  • ScrollPaneConstants.UPPER_LEADING_CORNER
  • ScrollPaneConstants.UPPER_TRAILING_CORNER

Parameters:
  key - one of the values as shown above the corner component (which may be null)identified by the given key, or nullif the key is invalid
See Also:   JScrollPane.setCorner



getHorizontalScrollBar
public JScrollBar getHorizontalScrollBar()(Code)
Returns the horizontal scroll bar that controls the viewport's horizontal view position. the horizontalScrollBar property
See Also:   JScrollPane.setHorizontalScrollBar



getHorizontalScrollBarPolicy
public int getHorizontalScrollBarPolicy()(Code)
Returns the horizontal scroll bar policy value. the horizontalScrollBarPolicy property
See Also:   JScrollPane.setHorizontalScrollBarPolicy



getRowHeader
public JViewport getRowHeader()(Code)
Returns the row header. the rowHeader property
See Also:   JScrollPane.setRowHeader



getUI
public ScrollPaneUI getUI()(Code)
Returns the look and feel (L&F) object that renders this component. the ScrollPaneUI object that renders thiscomponent
See Also:   JScrollPane.setUI



getUIClassID
public String getUIClassID()(Code)
Returns the suffix used to construct the name of the L&F class used to render this component. the string "ScrollPaneUI"
See Also:   JComponent.getUIClassID
See Also:   UIDefaults.getUI



getVerticalScrollBar
public JScrollBar getVerticalScrollBar()(Code)
Returns the vertical scroll bar that controls the viewports vertical view position. the verticalScrollBar property
See Also:   JScrollPane.setVerticalScrollBar



getVerticalScrollBarPolicy
public int getVerticalScrollBarPolicy()(Code)
Returns the vertical scroll bar policy value. the verticalScrollBarPolicy property
See Also:   JScrollPane.setVerticalScrollBarPolicy



getViewport
public JViewport getViewport()(Code)
Returns the current JViewport.
See Also:   JScrollPane.setViewport the viewport property



getViewportBorder
public Border getViewportBorder()(Code)
Returns the Border object that surrounds the viewport. the viewportBorder property
See Also:   JScrollPane.setViewportBorder



getViewportBorderBounds
public Rectangle getViewportBorderBounds()(Code)
Returns the bounds of the viewport's border. a Rectangle object specifying the viewport border



isValidateRoot
public boolean isValidateRoot()(Code)
Overridden to return true so that any calls to revalidate on any descendants of this JScrollPane will cause the entire tree beginning with this JScrollPane to be validated. true
See Also:   java.awt.Container.validate
See Also:   JComponent.revalidate
See Also:   JComponent.isValidateRoot



isWheelScrollingEnabled
public boolean isWheelScrollingEnabled()(Code)
Indicates whether or not scrolling will take place in response to the mouse wheel. Wheel scrolling is enabled by default.
See Also:   JScrollPane.setWheelScrollingEnabled
since:
   1.4



paramString
protected String paramString()(Code)
Returns a string representation of this JScrollPane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. a string representation of this JScrollPane.



setColumnHeader
public void setColumnHeader(JViewport columnHeader)(Code)
Removes the old columnHeader, if it exists; if the new columnHeader isn't null, syncs the x coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.

Most applications will find it more convenient to use setColumnHeaderView to add a column header component and its viewport to the scroll pane.
See Also:   JScrollPane.getColumnHeader
See Also:   JScrollPane.setColumnHeaderView




setColumnHeaderView
public void setColumnHeaderView(Component view)(Code)
Creates a column-header viewport if necessary, sets its view, and then adds the column-header viewport to the scrollpane. For example:
 JScrollPane scrollpane = new JScrollPane();
 scrollpane.setViewportView(myBigComponentToScroll);
 scrollpane.setColumnHeaderView(myBigComponentsColumnHeader);
 

See Also:   JScrollPane.setColumnHeader
See Also:   JViewport.setView
Parameters:
  view - the component to display as the column header



setComponentOrientation
public void setComponentOrientation(ComponentOrientation co)(Code)
Sets the orientation for the vertical and horizontal scrollbars as determined by the ComponentOrientation argument.
Parameters:
  co - one of the following values:
  • java.awt.ComponentOrientation.LEFT_TO_RIGHT
  • java.awt.ComponentOrientation.RIGHT_TO_LEFT
  • java.awt.ComponentOrientation.UNKNOWN

See Also:   java.awt.ComponentOrientation



setCorner
public void setCorner(String key, Component corner)(Code)
Adds a child that will appear in one of the scroll panes corners, if there's room. For example with both scrollbars showing (on the right and bottom edges of the scrollpane) the lower left corner component will be shown in the space between ends of the two scrollbars. Legal values for the key are:
  • ScrollPaneConstants.LOWER_LEFT_CORNER
  • ScrollPaneConstants.LOWER_RIGHT_CORNER
  • ScrollPaneConstants.UPPER_LEFT_CORNER
  • ScrollPaneConstants.UPPER_RIGHT_CORNER
  • ScrollPaneConstants.LOWER_LEADING_CORNER
  • ScrollPaneConstants.LOWER_TRAILING_CORNER
  • ScrollPaneConstants.UPPER_LEADING_CORNER
  • ScrollPaneConstants.UPPER_TRAILING_CORNER

Although "corner" doesn't match any beans property signature, PropertyChange events are generated with the property name set to the corner key.
Parameters:
  key - identifies which corner the component will appear in
Parameters:
  corner - one of the following components:

  • lowerLeft
  • lowerRight
  • upperLeft
  • upperRight

exception:
  IllegalArgumentException - if corner key is invalid



setHorizontalScrollBar
public void setHorizontalScrollBar(JScrollBar horizontalScrollBar)(Code)
Adds the scrollbar that controls the viewport's horizontal view position to the scrollpane. This is usually unnecessary, as JScrollPane creates horizontal and vertical scrollbars by default.
Parameters:
  horizontalScrollBar - the horizontal scrollbar to be added
See Also:   JScrollPane.createHorizontalScrollBar
See Also:   JScrollPane.getHorizontalScrollBar



setHorizontalScrollBarPolicy
public void setHorizontalScrollBarPolicy(int policy)(Code)
Determines when the horizontal scrollbar appears in the scrollpane. The options are:
  • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
  • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
  • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS

Parameters:
  policy - one of the three values listed above
exception:
  IllegalArgumentException - if policy is not one of the legal values shown above
See Also:   JScrollPane.getHorizontalScrollBarPolicy



setLayout
public void setLayout(LayoutManager layout)(Code)
Sets the layout manager for this JScrollPane. This method overrides setLayout in java.awt.Container to ensure that only LayoutManagers which are subclasses of ScrollPaneLayout can be used in a JScrollPane. If layout is non-null, this will invoke syncWithScrollPane on it.
Parameters:
  layout - the specified layout manager
exception:
  ClassCastException - if layout is not aScrollPaneLayout
See Also:   java.awt.Container.getLayout
See Also:   java.awt.Container.setLayout



setRowHeader
public void setRowHeader(JViewport rowHeader)(Code)
Removes the old rowHeader, if it exists; if the new rowHeader isn't null, syncs the y coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.

Most applications will find it more convenient to use setRowHeaderView to add a row header component and its viewport to the scroll pane.
Parameters:
  rowHeader - the new row header to be used; if nullthe old row header is still removed and the new rowHeaderis set to null
See Also:   JScrollPane.getRowHeader
See Also:   JScrollPane.setRowHeaderView




setRowHeaderView
public void setRowHeaderView(Component view)(Code)
Creates a row-header viewport if necessary, sets its view and then adds the row-header viewport to the scrollpane. For example:
 JScrollPane scrollpane = new JScrollPane();
 scrollpane.setViewportView(myBigComponentToScroll);
 scrollpane.setRowHeaderView(myBigComponentsRowHeader);
 

See Also:   JScrollPane.setRowHeader
See Also:   JViewport.setView
Parameters:
  view - the component to display as the row header



setUI
public void setUI(ScrollPaneUI ui)(Code)
Sets the ScrollPaneUI object that provides the look and feel (L&F) for this component.
Parameters:
  ui - the ScrollPaneUI L&F object
See Also:   JScrollPane.getUI



setVerticalScrollBar
public void setVerticalScrollBar(JScrollBar verticalScrollBar)(Code)
Adds the scrollbar that controls the viewports vertical view position to the scrollpane. This is usually unnecessary, as JScrollPane creates vertical and horizontal scrollbars by default.
Parameters:
  verticalScrollBar - the new vertical scrollbar to be added
See Also:   JScrollPane.createVerticalScrollBar
See Also:   JScrollPane.getVerticalScrollBar



setVerticalScrollBarPolicy
public void setVerticalScrollBarPolicy(int policy)(Code)
Determines when the vertical scrollbar appears in the scrollpane. Legal values are:
  • ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
  • ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
  • ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS

Parameters:
  policy - one of the three values listed above
exception:
  IllegalArgumentException - if policy is not one of the legal values shown above
See Also:   JScrollPane.getVerticalScrollBarPolicy



setViewport
public void setViewport(JViewport viewport)(Code)
Removes the old viewport (if there is one); forces the viewPosition of the new viewport to be in the +x,+y quadrant; syncs up the row and column headers (if there are any) with the new viewport; and finally syncs the scrollbars and headers with the new viewport.

Most applications will find it more convenient to use setViewportView to add a viewport and a view to the scrollpane.
Parameters:
  viewport - the new viewport to be used; if viewport isnull, the old viewport is still removedand the new viewport is set to null
See Also:   JScrollPane.createViewport
See Also:   JScrollPane.getViewport
See Also:   JScrollPane.setViewportView




setViewportBorder
public void setViewportBorder(Border viewportBorder)(Code)
Adds a border around the viewport. Note that the border isn't set on the viewport directly, JViewport doesn't support the JComponent border property. Similarly setting the JScrollPanes viewport doesn't affect the viewportBorder property.

The default value of this property is computed by the look and feel implementation.
Parameters:
  viewportBorder - the border to be added
See Also:   JScrollPane.getViewportBorder
See Also:   JScrollPane.setViewport




setViewportView
public void setViewportView(Component view)(Code)
Creates a viewport if necessary and then sets its view. Applications that don't provide the view directly to the JScrollPane constructor should use this method to specify the scrollable child that's going to be displayed in the scrollpane. For example:
 JScrollPane scrollpane = new JScrollPane();
 scrollpane.setViewportView(myBigComponentToScroll);
 
Applications should not add children directly to the scrollpane.
Parameters:
  view - the component to add to the viewport
See Also:   JScrollPane.setViewport
See Also:   JViewport.setView



setWheelScrollingEnabled
public void setWheelScrollingEnabled(boolean handleWheel)(Code)
Enables/disables scrolling in response to movement of the mouse wheel. Wheel scrolling is enabled by default.
Parameters:
  handleWheel - true if scrolling should be doneautomatically for a MouseWheelEvent,false otherwise.
See Also:   JScrollPane.isWheelScrollingEnabled
See Also:   java.awt.event.MouseWheelEvent
See Also:   java.awt.event.MouseWheelListener
since:
   1.4



updateUI
public void updateUI()(Code)
Replaces the current ScrollPaneUI object with a version from the current default look and feel. To be called when the default look and feel changes.
See Also:   JComponent.updateUI
See Also:   UIManager.getUI



Fields inherited from javax.swing.JComponent
static boolean DEBUG_GRAPHICS_LOADED(Code)(Java Doc)
final public static String TOOL_TIP_TEXT_KEY(Code)(Java Doc)
final public static int UNDEFINED_CONDITION(Code)(Java Doc)
final public static int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT(Code)(Java Doc)
final public static int WHEN_FOCUSED(Code)(Java Doc)
final public static int WHEN_IN_FOCUSED_WINDOW(Code)(Java Doc)
protected AccessibleContext accessibleContext(Code)(Java Doc)
final static sun.awt.RequestFocusController focusController(Code)(Java Doc)
protected EventListenerList listenerList(Code)(Java Doc)
transient Component paintingChild(Code)(Java Doc)
protected transient ComponentUI ui(Code)(Java Doc)

Methods inherited from javax.swing.JComponent
void _paintImmediately(int x, int y, int w, int h)(Code)(Java Doc)
public void addAncestorListener(AncestorListener listener)(Code)(Java Doc)
public void addNotify()(Code)(Java Doc)
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
boolean alwaysOnTop()(Code)(Java Doc)
boolean checkIfChildObscuredBySibling()(Code)(Java Doc)
void clientPropertyChanged(Object key, Object oldValue, Object newValue)(Code)(Java Doc)
void compWriteObjectNotify()(Code)(Java Doc)
void componentInputMapChanged(ComponentInputMap inputMap)(Code)(Java Doc)
final static void computeVisibleRect(Component c, Rectangle visibleRect)(Code)(Java Doc)
public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc)
public boolean contains(int x, int y)(Code)(Java Doc)
public JToolTip createToolTip()(Code)(Java Doc)
public void disable()(Code)(Java Doc)
void dndDone()(Code)(Java Doc)
TransferHandler.DropLocation dropLocationForPoint(Point p)(Code)(Java Doc)
public void enable()(Code)(Java Doc)
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc)
protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc)
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc)
final public ActionMap getActionMap()(Code)(Java Doc)
final ActionMap getActionMap(boolean create)(Code)(Java Doc)
public float getAlignmentX()(Code)(Java Doc)
public float getAlignmentY()(Code)(Java Doc)
public AncestorListener[] getAncestorListeners()(Code)(Java Doc)
public boolean getAutoscrolls()(Code)(Java Doc)
public int getBaseline(int width, int height)(Code)(Java Doc)
public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc)
public Border getBorder()(Code)(Java Doc)
public Rectangle getBounds(Rectangle rv)(Code)(Java Doc)
final public Object getClientProperty(Object key)(Code)(Java Doc)
protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc)
public JPopupMenu getComponentPopupMenu()(Code)(Java Doc)
public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc)
boolean getCreatedDoubleBuffer()(Code)(Java Doc)
public int getDebugGraphicsOptions()(Code)(Java Doc)
public static Locale getDefaultLocale()(Code)(Java Doc)
public FontMetrics getFontMetrics(Font font)(Code)(Java Doc)
public Graphics getGraphics()(Code)(Java Doc)
static void getGraphicsInvoked(Component root)(Code)(Java Doc)
public int getHeight()(Code)(Java Doc)
public boolean getInheritsPopupMenu()(Code)(Java Doc)
final public InputMap getInputMap(int condition)(Code)(Java Doc)
final public InputMap getInputMap()(Code)(Java Doc)
final InputMap getInputMap(int condition, boolean create)(Code)(Java Doc)
public InputVerifier getInputVerifier()(Code)(Java Doc)
public Insets getInsets()(Code)(Java Doc)
public Insets getInsets(Insets insets)(Code)(Java Doc)
public T[] getListeners(Class<T> listenerType)(Code)(Java Doc)
public Point getLocation(Point rv)(Code)(Java Doc)
static Set<KeyStroke> getManagingFocusBackwardTraversalKeys()(Code)(Java Doc)
static Set<KeyStroke> getManagingFocusForwardTraversalKeys()(Code)(Java Doc)
public Dimension getMaximumSize()(Code)(Java Doc)
public Dimension getMinimumSize()(Code)(Java Doc)
public Component getNextFocusableComponent()(Code)(Java Doc)
public Point getPopupLocation(MouseEvent event)(Code)(Java Doc)
public Dimension getPreferredSize()(Code)(Java Doc)
public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc)
public JRootPane getRootPane()(Code)(Java Doc)
public Dimension getSize(Dimension rv)(Code)(Java Doc)
public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc)
public String getToolTipText()(Code)(Java Doc)
public String getToolTipText(MouseEvent event)(Code)(Java Doc)
public Container getTopLevelAncestor()(Code)(Java Doc)
public TransferHandler getTransferHandler()(Code)(Java Doc)
public String getUIClassID()(Code)(Java Doc)
public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc)
public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc)
public Rectangle getVisibleRect()(Code)(Java Doc)
public int getWidth()(Code)(Java Doc)
static byte getWriteObjCounter(JComponent comp)(Code)(Java Doc)
public int getX()(Code)(Java Doc)
public int getY()(Code)(Java Doc)
public void grabFocus()(Code)(Java Doc)
public boolean isDoubleBuffered()(Code)(Java Doc)
public static boolean isLightweightComponent(Component c)(Code)(Java Doc)
public boolean isManagingFocus()(Code)(Java Doc)
public boolean isOpaque()(Code)(Java Doc)
public boolean isOptimizedDrawingEnabled()(Code)(Java Doc)
boolean isPainting()(Code)(Java Doc)
final public boolean isPaintingForPrint()(Code)(Java Doc)
boolean isPaintingOrigin()(Code)(Java Doc)
public boolean isPaintingTile()(Code)(Java Doc)
public boolean isRequestFocusEnabled()(Code)(Java Doc)
public boolean isValidateRoot()(Code)(Java Doc)
public void paint(Graphics g)(Code)(Java Doc)
protected void paintBorder(Graphics g)(Code)(Java Doc)
protected void paintChildren(Graphics g)(Code)(Java Doc)
protected void paintComponent(Graphics g)(Code)(Java Doc)
void paintForceDoubleBuffered(Graphics g)(Code)(Java Doc)
public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc)
public void paintImmediately(Rectangle r)(Code)(Java Doc)
void paintToOffscreen(Graphics g, int x, int y, int w, int h, int maxX, int maxY)(Code)(Java Doc)
protected String paramString()(Code)(Java Doc)
public void print(Graphics g)(Code)(Java Doc)
public void printAll(Graphics g)(Code)(Java Doc)
protected void printBorder(Graphics g)(Code)(Java Doc)
protected void printChildren(Graphics g)(Code)(Java Doc)
protected void printComponent(Graphics g)(Code)(Java Doc)
protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc)
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc)
boolean processKeyBindings(KeyEvent e, boolean pressed)(Code)(Java Doc)
static boolean processKeyBindingsForAllComponents(KeyEvent e, Container container, boolean pressed)(Code)(Java Doc)
protected void processKeyEvent(KeyEvent e)(Code)(Java Doc)
protected void processMouseEvent(MouseEvent e)(Code)(Java Doc)
protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc)
final public void putClientProperty(Object key, Object value)(Code)(Java Doc)
boolean rectangleIsObscured(int x, int y, int width, int height)(Code)(Java Doc)
public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc)
public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc)
public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc)
public void removeNotify()(Code)(Java Doc)
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc)
public void repaint(Rectangle r)(Code)(Java Doc)
public boolean requestDefaultFocus()(Code)(Java Doc)
public void requestFocus()(Code)(Java Doc)
public boolean requestFocus(boolean temporary)(Code)(Java Doc)
public boolean requestFocusInWindow()(Code)(Java Doc)
protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc)
public void resetKeyboardActions()(Code)(Java Doc)
public void reshape(int x, int y, int w, int h)(Code)(Java Doc)
public void revalidate()(Code)(Java Doc)
static Graphics safelyGetGraphics(Component c)(Code)(Java Doc)
static Graphics safelyGetGraphics(Component c, Component root)(Code)(Java Doc)
public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc)
final public void setActionMap(ActionMap am)(Code)(Java Doc)
public void setAlignmentX(float alignmentX)(Code)(Java Doc)
public void setAlignmentY(float alignmentY)(Code)(Java Doc)
public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc)
public void setBackground(Color bg)(Code)(Java Doc)
public void setBorder(Border border)(Code)(Java Doc)
public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc)
void setCreatedDoubleBuffer(boolean newValue)(Code)(Java Doc)
public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc)
public static void setDefaultLocale(Locale l)(Code)(Java Doc)
public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc)
Object setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop)(Code)(Java Doc)
public void setEnabled(boolean enabled)(Code)(Java Doc)
public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc)
public void setFont(Font font)(Code)(Java Doc)
public void setForeground(Color fg)(Code)(Java Doc)
public void setInheritsPopupMenu(boolean value)(Code)(Java Doc)
final public void setInputMap(int condition, InputMap map)(Code)(Java Doc)
public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc)
public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc)
public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc)
public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc)
public void setOpaque(boolean isOpaque)(Code)(Java Doc)
void setPaintingChild(Component paintingChild)(Code)(Java Doc)
public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc)
public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc)
public void setToolTipText(String text)(Code)(Java Doc)
public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc)
protected void setUI(ComponentUI newUI)(Code)(Java Doc)
void setUIProperty(String propertyName, Object value)(Code)(Java Doc)
public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc)
public void setVisible(boolean aFlag)(Code)(Java Doc)
static void setWriteObjCounter(JComponent comp, byte count)(Code)(Java Doc)
int shouldDebugGraphics()(Code)(Java Doc)
void superProcessMouseMotionEvent(MouseEvent e)(Code)(Java Doc)
public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc)
public void update(Graphics g)(Code)(Java Doc)
public void updateUI()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.