java.lang.Objectjavax.swing.ScrollPaneLayout
public class ScrollPaneLayout
The layout manager used by JScrollPane.
JScrollPaneLayout is
responsible for nine components: a viewport, two scrollbars,
a row header, a column header, and four "corner" components.
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 XMLEncoder.
JScrollPane,
JViewport| Nested Class Summary | |
|---|---|
static class |
ScrollPaneLayout.UIResource
The UI resource version of ScrollPaneLayout. |
| Field Summary | |
|---|---|
protected JViewport |
colHead
The column header child. |
protected JScrollBar |
hsb
The scrollpane's horizontal scrollbar child. |
protected int |
hsbPolicy
The display policy for the horizontal scrollbar. |
protected Component |
lowerLeft
The component to display in the lower left corner. |
protected Component |
lowerRight
The component to display in the lower right corner. |
protected JViewport |
rowHead
The row header child. |
protected Component |
upperLeft
The component to display in the upper left corner. |
protected Component |
upperRight
The component to display in the upper right corner. |
protected JViewport |
viewport
The scrollpane's viewport child. |
protected JScrollBar |
vsb
The scrollpane's vertical scrollbar child. |
protected int |
vsbPolicy
The display policy for the vertical scrollbar. |
| Constructor Summary | |
|---|---|
ScrollPaneLayout()
|
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(String s,
Component c)
Adds the specified component to the layout. |
protected Component |
addSingletonComponent(Component oldC,
Component newC)
Removes an existing component. |
JViewport |
getColumnHeader()
Returns the JViewport object that is the column header. |
Component |
getCorner(String key)
Returns the Component at the specified corner. |
JScrollBar |
getHorizontalScrollBar()
Returns the JScrollBar object that handles horizontal scrolling. |
int |
getHorizontalScrollBarPolicy()
Returns the horizontal scrollbar-display policy. |
JViewport |
getRowHeader()
Returns the JViewport object that is the row header. |
JScrollBar |
getVerticalScrollBar()
Returns the JScrollBar object that handles vertical scrolling. |
int |
getVerticalScrollBarPolicy()
Returns the vertical scrollbar-display policy. |
JViewport |
getViewport()
Returns the JViewport object that displays the
scrollable contents. |
Rectangle |
getViewportBorderBounds(JScrollPane scrollpane)
Deprecated. As of JDK version Swing1.1 replaced by JScrollPane.getViewportBorderBounds(). |
void |
layoutContainer(Container parent)
Lays out the scrollpane. |
Dimension |
minimumLayoutSize(Container parent)
The minimum size of a ScrollPane is the size of the insets
plus minimum size of the viewport, plus the scrollpane's
viewportBorder insets, plus the minimum size
of the visible headers, plus the minimum size of the
scrollbars whose displayPolicy isn't NEVER. |
Dimension |
preferredLayoutSize(Container parent)
The preferred size of a ScrollPane is the size of the insets,
plus the preferred size of the viewport, plus the preferred size of
the visible headers, plus the preferred size of the scrollbars
that will appear given the current view and the current
scrollbar displayPolicies. |
void |
removeLayoutComponent(Component c)
Removes the specified component from the layout. |
void |
setHorizontalScrollBarPolicy(int x)
Sets the horizontal scrollbar-display policy. |
void |
setVerticalScrollBarPolicy(int x)
Sets the vertical scrollbar-display policy. |
void |
syncWithScrollPane(JScrollPane sp)
This method is invoked after the ScrollPaneLayout is set as the LayoutManager of a JScrollPane. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected JViewport viewport
JViewport.
protected JScrollBar vsb
JScrollBar.
protected JScrollBar hsb
JScrollBar.
protected JViewport rowHead
null.
protected JViewport colHead
null.
protected Component lowerLeft
null.
protected Component lowerRight
null.
protected Component upperLeft
null.
protected Component upperRight
null.
protected int vsbPolicy
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED.
This field is obsolete, please use the JScrollPane field instead.
protected int hsbPolicy
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED.
This field is obsolete, please use the JScrollPane field instead.
| Constructor Detail |
|---|
public ScrollPaneLayout()
| Method Detail |
|---|
public void syncWithScrollPane(JScrollPane sp)
JScrollPane.
It initializes all of the internal fields that
are ordinarily set by addLayoutComponent. For example:
super.layoutContainer(p); // do some extra work here ... } }; scrollpane.setLayout(mySPLayout):
protected Component addSingletonComponent(Component oldC, Component newC)
This method returns newC. If oldC is
not equal to newC and is non-null,
it will be removed from its parent.
oldC - the Component to replacenewC - the Component to add
newCpublic void addLayoutComponent(String s, Component c)
addLayoutComponent in interface LayoutManagers - the component identifierc - the the component to be added
IllegalArgumentException - if s is an invalid keypublic void removeLayoutComponent(Component c)
removeLayoutComponent in interface LayoutManagerc - the component to removepublic int getVerticalScrollBarPolicy()
setVerticalScrollBarPolicy(int)public void setVerticalScrollBarPolicy(int x)
JScrollPane version
of this method. It only exists for backwards compatibility
with the Swing 1.0.2 (and earlier) versions of this class.
x - an integer giving the display policy
IllegalArgumentException - if x is an invalid
vertical scroll bar policy, as listed abovepublic int getHorizontalScrollBarPolicy()
setHorizontalScrollBarPolicy(int)public void setHorizontalScrollBarPolicy(int x)
JScrollPane version
of this method. It only exists for backwards compatibility
with the Swing 1.0.2 (and earlier) versions of this class.
x - an int giving the display policy
IllegalArgumentException - if x is not a valid
horizontal scrollbar policy, as listed abovepublic JViewport getViewport()
JViewport object that displays the
scrollable contents.
JViewport object that displays the scrollable contentsJScrollPane.getViewport()public JScrollBar getHorizontalScrollBar()
JScrollBar object that handles horizontal scrolling.
JScrollBar object that handles horizontal scrollingJScrollPane.getHorizontalScrollBar()public JScrollBar getVerticalScrollBar()
JScrollBar object that handles vertical scrolling.
JScrollBar object that handles vertical scrollingJScrollPane.getVerticalScrollBar()public JViewport getRowHeader()
JViewport object that is the row header.
JViewport object that is the row headerJScrollPane.getRowHeader()public JViewport getColumnHeader()
JViewport object that is the column header.
JViewport object that is the column headerJScrollPane.getColumnHeader()public Component getCorner(String key)
Component at the specified corner.
key - the String specifying the corner
Component at the specified corner, as defined in
ScrollPaneConstants; if key is not one of the
four corners, null is returnedJScrollPane.getCorner(java.lang.String)public Dimension preferredLayoutSize(Container parent)
ScrollPane is the size of the insets,
plus the preferred size of the viewport, plus the preferred size of
the visible headers, plus the preferred size of the scrollbars
that will appear given the current view and the current
scrollbar displayPolicies.
Note that the rowHeader is calculated as part of the preferred width and the colHeader is calculated as part of the preferred size.
preferredLayoutSize in interface LayoutManagerparent - the Container that will be laid out
Dimension object specifying the preferred size of the
viewport and any scrollbarsViewportLayout,
LayoutManagerpublic Dimension minimumLayoutSize(Container parent)
ScrollPane is the size of the insets
plus minimum size of the viewport, plus the scrollpane's
viewportBorder insets, plus the minimum size
of the visible headers, plus the minimum size of the
scrollbars whose displayPolicy isn't NEVER.
minimumLayoutSize in interface LayoutManagerparent - the Container that will be laid out
Dimension object specifying the minimum sizeLayoutManager.preferredLayoutSize(java.awt.Container)public void layoutContainer(Container parent)
displayPolicy
is ALWAYS, it's treated like the row header with respect to its
dimensions and is made visible.
null
viewportBorder, then space is allocated for that.
layoutContainer in interface LayoutManagerparent - the Container to lay out@Deprecated public Rectangle getViewportBorderBounds(JScrollPane scrollpane)
JScrollPane.getViewportBorderBounds().
Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)