< prev index next >
src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java
Print this page
@@ -36,22 +36,22 @@
import java.awt.Insets;
import java.io.Serializable;
/**
- * The layout manager used by <code>JScrollPane</code>.
- * <code>JScrollPaneLayout</code> is
+ * The layout manager used by {@code JScrollPane}.
+ * {@code JScrollPaneLayout} is
* responsible for nine components: a viewport, two scrollbars,
* a row header, a column header, and four "corner" components.
* <p>
* <strong>Warning:</strong>
* 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 JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JScrollPane
* @see JViewport
*
@@ -63,105 +63,105 @@
implements LayoutManager, ScrollPaneConstants, Serializable
{
/**
* The scrollpane's viewport child.
- * Default is an empty <code>JViewport</code>.
+ * Default is an empty {@code JViewport}.
* @see JScrollPane#setViewport
*/
protected JViewport viewport;
/**
* The scrollpane's vertical scrollbar child.
- * Default is a <code>JScrollBar</code>.
+ * Default is a {@code JScrollBar}.
* @see JScrollPane#setVerticalScrollBar
*/
protected JScrollBar vsb;
/**
* The scrollpane's horizontal scrollbar child.
- * Default is a <code>JScrollBar</code>.
+ * Default is a {@code JScrollBar}.
* @see JScrollPane#setHorizontalScrollBar
*/
protected JScrollBar hsb;
/**
- * The row header child. Default is <code>null</code>.
+ * The row header child. Default is {@code null}.
* @see JScrollPane#setRowHeader
*/
protected JViewport rowHead;
/**
- * The column header child. Default is <code>null</code>.
+ * The column header child. Default is {@code null}.
* @see JScrollPane#setColumnHeader
*/
protected JViewport colHead;
/**
* The component to display in the lower left corner.
- * Default is <code>null</code>.
+ * Default is {@code null}.
* @see JScrollPane#setCorner
*/
protected Component lowerLeft;
/**
* The component to display in the lower right corner.
- * Default is <code>null</code>.
+ * Default is {@code null}.
* @see JScrollPane#setCorner
*/
protected Component lowerRight;
/**
* The component to display in the upper left corner.
- * Default is <code>null</code>.
+ * Default is {@code null}.
* @see JScrollPane#setCorner
*/
protected Component upperLeft;
/**
* The component to display in the upper right corner.
- * Default is <code>null</code>.
+ * Default is {@code null}.
* @see JScrollPane#setCorner
*/
protected Component upperRight;
/**
* The display policy for the vertical scrollbar.
- * The default is <code>ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED</code>.
+ * The default is {@code ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED}.
* <p>
- * This field is obsolete, please use the <code>JScrollPane</code> field instead.
+ * This field is obsolete, please use the {@code JScrollPane} field instead.
*
* @see JScrollPane#setVerticalScrollBarPolicy
*/
protected int vsbPolicy = VERTICAL_SCROLLBAR_AS_NEEDED;
/**
* The display policy for the horizontal scrollbar.
- * The default is <code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED</code>.
+ * The default is {@code ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED}.
* <p>
- * This field is obsolete, please use the <code>JScrollPane</code> field instead.
+ * This field is obsolete, please use the {@code JScrollPane} field instead.
*
* @see JScrollPane#setHorizontalScrollBarPolicy
*/
protected int hsbPolicy = HORIZONTAL_SCROLLBAR_AS_NEEDED;
/**
* This method is invoked after the ScrollPaneLayout is set as the
- * LayoutManager of a <code>JScrollPane</code>.
+ * LayoutManager of a {@code JScrollPane}.
* It initializes all of the internal fields that
- * are ordinarily set by <code>addLayoutComponent</code>. For example:
+ * are ordinarily set by {@code addLayoutComponent}. For example:
* <pre>
* ScrollPaneLayout mySPLayout = new ScrollPanelLayout() {
* public void layoutContainer(Container p) {
* super.layoutContainer(p);
* // do some extra work here ...
@@ -190,17 +190,17 @@
/**
* Removes an existing component. When a new component, such as
* the left corner, or vertical scrollbar, is added, the old one,
* if it exists, must be removed.
* <p>
- * This method returns <code>newC</code>. If <code>oldC</code> is
- * not equal to <code>newC</code> and is non-<code>null</code>,
+ * This method returns {@code newC}. If {@code oldC} is
+ * not equal to {@code newC} and is non-{@code null},
* it will be removed from its parent.
*
- * @param oldC the <code>Component</code> to replace
- * @param newC the <code>Component</code> to add
- * @return the <code>newC</code>
+ * @param oldC the {@code Component} to replace
+ * @param newC the {@code Component} to add
+ * @return the {@code newC}
*/
protected Component addSingletonComponent(Component oldC, Component newC)
{
if ((oldC != null) && (oldC != newC)) {
oldC.getParent().remove(oldC);
@@ -224,11 +224,11 @@
* <li>ScrollPaneConstants.UPPER_RIGHT_CORNER
* </ul>
*
* @param s the component identifier
* @param c the component to be added
- * @exception IllegalArgumentException if <code>s</code> is an invalid key
+ * @exception IllegalArgumentException if {@code s} is an invalid key
*/
public void addLayoutComponent(String s, Component c)
{
if (s.equals(VIEWPORT)) {
viewport = (JViewport)addSingletonComponent(viewport, c);
@@ -317,16 +317,16 @@
* <ul>
* <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
* <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
* <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
* </ul>
- * Note: Applications should use the <code>JScrollPane</code> version
+ * Note: Applications should use the {@code JScrollPane} version
* of this method. It only exists for backwards compatibility
* with the Swing 1.0.2 (and earlier) versions of this class.
*
* @param x an integer giving the display policy
- * @exception IllegalArgumentException if <code>x</code> is an invalid
+ * @exception IllegalArgumentException if {@code x} is an invalid
* vertical scroll bar policy, as listed above
*/
public void setVerticalScrollBarPolicy(int x) {
switch (x) {
case VERTICAL_SCROLLBAR_AS_NEEDED:
@@ -355,16 +355,16 @@
* The options are:<ul>
* <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
* <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
* <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
* </ul>
- * Note: Applications should use the <code>JScrollPane</code> version
+ * Note: Applications should use the {@code JScrollPane} version
* of this method. It only exists for backwards compatibility
* with the Swing 1.0.2 (and earlier) versions of this class.
*
* @param x an int giving the display policy
- * @exception IllegalArgumentException if <code>x</code> is not a valid
+ * @exception IllegalArgumentException if {@code x} is not a valid
* horizontal scrollbar policy, as listed above
*/
public void setHorizontalScrollBarPolicy(int x) {
switch (x) {
case HORIZONTAL_SCROLLBAR_AS_NEEDED:
@@ -377,65 +377,65 @@
}
}
/**
- * Returns the <code>JViewport</code> object that displays the
+ * Returns the {@code JViewport} object that displays the
* scrollable contents.
- * @return the <code>JViewport</code> object that displays the scrollable contents
+ * @return the {@code JViewport} object that displays the scrollable contents
* @see JScrollPane#getViewport
*/
public JViewport getViewport() {
return viewport;
}
/**
- * Returns the <code>JScrollBar</code> object that handles horizontal scrolling.
- * @return the <code>JScrollBar</code> object that handles horizontal scrolling
+ * Returns the {@code JScrollBar} object that handles horizontal scrolling.
+ * @return the {@code JScrollBar} object that handles horizontal scrolling
* @see JScrollPane#getHorizontalScrollBar
*/
public JScrollBar getHorizontalScrollBar() {
return hsb;
}
/**
- * Returns the <code>JScrollBar</code> object that handles vertical scrolling.
- * @return the <code>JScrollBar</code> object that handles vertical scrolling
+ * Returns the {@code JScrollBar} object that handles vertical scrolling.
+ * @return the {@code JScrollBar} object that handles vertical scrolling
* @see JScrollPane#getVerticalScrollBar
*/
public JScrollBar getVerticalScrollBar() {
return vsb;
}
/**
- * Returns the <code>JViewport</code> object that is the row header.
- * @return the <code>JViewport</code> object that is the row header
+ * Returns the {@code JViewport} object that is the row header.
+ * @return the {@code JViewport} object that is the row header
* @see JScrollPane#getRowHeader
*/
public JViewport getRowHeader() {
return rowHead;
}
/**
- * Returns the <code>JViewport</code> object that is the column header.
- * @return the <code>JViewport</code> object that is the column header
+ * Returns the {@code JViewport} object that is the column header.
+ * @return the {@code JViewport} object that is the column header
* @see JScrollPane#getColumnHeader
*/
public JViewport getColumnHeader() {
return colHead;
}
/**
- * Returns the <code>Component</code> at the specified corner.
- * @param key the <code>String</code> specifying the corner
- * @return the <code>Component</code> at the specified corner, as defined in
- * {@link ScrollPaneConstants}; if <code>key</code> is not one of the
- * four corners, <code>null</code> is returned
+ * Returns the {@code Component} at the specified corner.
+ * @param key the {@code String} specifying the corner
+ * @return the {@code Component} at the specified corner, as defined in
+ * {@link ScrollPaneConstants}; if {@code key} is not one of the
+ * four corners, {@code null} is returned
* @see JScrollPane#getCorner
*/
public Component getCorner(String key) {
if (key.equals(LOWER_LEFT_CORNER)) {
return lowerLeft;
@@ -454,20 +454,20 @@
}
}
/**
- * The preferred size of a <code>ScrollPane</code> is the size of the insets,
+ * The preferred size of a {@code 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.
* <p>Note that the rowHeader is calculated as part of the preferred width
* and the colHeader is calculated as part of the preferred size.
*
- * @param parent the <code>Container</code> that will be laid out
- * @return a <code>Dimension</code> object specifying the preferred size of the
+ * @param parent the {@code Container} that will be laid out
+ * @return a {@code Dimension} object specifying the preferred size of the
* viewport and any scrollbars
* @see ViewportLayout
* @see LayoutManager
*/
public Dimension preferredLayoutSize(Container parent)
@@ -582,18 +582,18 @@
return new Dimension(prefWidth, prefHeight);
}
/**
- * The minimum size of a <code>ScrollPane</code> is the size of the insets
+ * The minimum size of a {@code 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.
*
- * @param parent the <code>Container</code> that will be laid out
- * @return a <code>Dimension</code> object specifying the minimum size
+ * @param parent the {@code Container} that will be laid out
+ * @return a {@code Dimension} object specifying the minimum size
*/
public Dimension minimumLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
@@ -670,19 +670,19 @@
*
* <li> The column header, if present and visible, gets its preferred
* height and the viewport's width.
*
* <li> If a vertical scrollbar is needed, i.e. if the viewport's extent
- * height is smaller than its view height or if the <code>displayPolicy</code>
+ * height is smaller than its view height or if the {@code displayPolicy}
* is ALWAYS, it's treated like the row header with respect to its
* dimensions and is made visible.
*
* <li> If a horizontal scrollbar is needed, it is treated like the
* column header (see the paragraph above regarding the vertical scrollbar).
*
- * <li> If the scrollpane has a non-<code>null</code>
- * <code>viewportBorder</code>, then space is allocated for that.
+ * <li> If the scrollpane has a non-{@code null}
+ * {@code viewportBorder}, then space is allocated for that.
*
* <li> The viewport gets the space available after accounting for
* the previous constraints.
*
* <li> The corner components, if provided, are aligned with the
@@ -690,11 +690,11 @@
* scrollbar, the right corners appear; if there is a horizontal
* scrollbar, the lower corners appear; a row header gets left
* corners, and a column header gets upper corners.
* </ul>
*
- * @param parent the <code>Container</code> to lay out
+ * @param parent the {@code Container} to lay out
*/
public void layoutContainer(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
@@ -1041,15 +1041,15 @@
colHeadR.height);
}
}
/**
- * Adjusts the <code>Rectangle</code> <code>available</code> based on if
- * the vertical scrollbar is needed (<code>wantsVSB</code>).
- * The location of the vsb is updated in <code>vsbR</code>, and
- * the viewport border insets (<code>vpbInsets</code>) are used to offset
- * the vsb. This is only called when <code>wantsVSB</code> has
+ * Adjusts the {@code Rectangle available} based on if
+ * the vertical scrollbar is needed ({@code wantsVSB}).
+ * The location of the vsb is updated in {@code vsbR}, and
+ * the viewport border insets ({@code vpbInsets}) are used to offset
+ * the vsb. This is only called when {@code wantsVSB} has
* changed, eg you shouldn't invoke adjustForVSB(true) twice.
*/
private void adjustForVSB(boolean wantsVSB, Rectangle available,
Rectangle vsbR, Insets vpbInsets,
boolean leftToRight) {
@@ -1072,15 +1072,15 @@
available.width += oldWidth;
}
}
/**
- * Adjusts the <code>Rectangle</code> <code>available</code> based on if
- * the horizontal scrollbar is needed (<code>wantsHSB</code>).
- * The location of the hsb is updated in <code>hsbR</code>, and
- * the viewport border insets (<code>vpbInsets</code>) are used to offset
- * the hsb. This is only called when <code>wantsHSB</code> has
+ * Adjusts the {@code Rectangle available} based on if
+ * the horizontal scrollbar is needed ({@code wantsHSB}).
+ * The location of the hsb is updated in {@code hsbR}, and
+ * the viewport border insets ({@code vpbInsets}) are used to offset
+ * the hsb. This is only called when {@code wantsHSB} has
* changed, eg you shouldn't invoked adjustForHSB(true) twice.
*/
private void adjustForHSB(boolean wantsHSB, Rectangle available,
Rectangle hsbR, Insets vpbInsets) {
int oldHeight = hsbR.height;
@@ -1104,17 +1104,17 @@
* viewport.
*
* @param scrollpane an instance of the {@code JScrollPane}
* @return the size and position of the viewport border
* @deprecated As of JDK version Swing1.1
- * replaced by <code>JScrollPane.getViewportBorderBounds()</code>.
+ * replaced by {@code JScrollPane.getViewportBorderBounds()}.
*/
@Deprecated
public Rectangle getViewportBorderBounds(JScrollPane scrollpane) {
return scrollpane.getViewportBorderBounds();
}
/**
- * The UI resource version of <code>ScrollPaneLayout</code>.
+ * The UI resource version of {@code ScrollPaneLayout}.
*/
public static class UIResource extends ScrollPaneLayout implements javax.swing.plaf.UIResource {}
}
< prev index next >