src/java.desktop/share/classes/javax/swing/JScrollPane.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 20,30 ****
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package javax.swing;
import javax.swing.plaf.*;
import javax.swing.border.*;
import javax.swing.event.*;
--- 20,29 ----
*** 38,47 ****
--- 37,48 ----
import java.awt.Point;
import java.io.ObjectOutputStream;
import java.io.IOException;
+ import java.beans.JavaBean;
+ import java.beans.BeanProperty;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.Transient;
/**
*** 159,176 ****
* @see #setRowHeaderView
* @see #setColumnHeaderView
* @see #setCorner
* @see #setViewportBorder
*
- * @beaninfo
- * attribute: isContainer true
- * attribute: containerDelegate getViewport
- * description: A specialized container that manages a viewport, optional scrollbars and headers
- *
* @author Hans Muller
* @since 1.2
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JScrollPane extends JComponent implements ScrollPaneConstants, Accessible
{
private Border viewportBorder;
--- 160,174 ----
* @see #setRowHeaderView
* @see #setColumnHeaderView
* @see #setCorner
* @see #setViewportBorder
*
* @author Hans Muller
* @since 1.2
*/
+ @JavaBean(defaultProperty = "UI", description = "A specialized container that manages a viewport, optional scrollbars and headers")
+ @SwingContainer(delegate = "getViewport")
@SuppressWarnings("serial") // Same-version serialization only
public class JScrollPane extends JComponent implements ScrollPaneConstants, Accessible
{
private Border viewportBorder;
*** 358,373 ****
* Returns the look and feel (L&F) object that renders this component.
*
* @return the <code>ScrollPaneUI</code> object that renders this
* component
* @see #setUI
- * @beaninfo
- * bound: true
- * hidden: true
- * attribute: visualUpdate true
- * description: The UI object that implements the Component's LookAndFeel.
*/
public ScrollPaneUI getUI() {
return (ScrollPaneUI)ui;
}
--- 356,368 ----
* Returns the look and feel (L&F) object that renders this component.
*
* @return the <code>ScrollPaneUI</code> object that renders this
* component
* @see #setUI
*/
+ @BeanProperty(hidden = true, visualUpdate = true, description
+ = "The UI object that implements the Component's LookAndFeel.")
public ScrollPaneUI getUI() {
return (ScrollPaneUI)ui;
}
*** 401,414 ****
* render this component.
*
* @return the string "ScrollPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
- *
- * @beaninfo
- * hidden: true
*/
public String getUIClassID() {
return uiClassID;
}
--- 396,407 ----
* render this component.
*
* @return the string "ScrollPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false, hidden = true)
public String getUIClassID() {
return uiClassID;
}
*** 425,437 ****
* @param layout the specified layout manager
* @exception ClassCastException if layout is not a
* <code>ScrollPaneLayout</code>
* @see java.awt.Container#getLayout
* @see java.awt.Container#setLayout
- *
- * @beaninfo
- * hidden: true
*/
public void setLayout(LayoutManager layout) {
if (layout instanceof ScrollPaneLayout) {
super.setLayout(layout);
((ScrollPaneLayout)layout).syncWithScrollPane(this);
--- 418,427 ----
*** 454,468 ****
* @return true
* @see java.awt.Container#validate
* @see JComponent#revalidate
* @see JComponent#isValidateRoot
* @see java.awt.Container#isValidateRoot
- *
- * @beaninfo
- * hidden: true
*/
@Override
public boolean isValidateRoot() {
return true;
}
--- 444,456 ----
* @return true
* @see java.awt.Container#validate
* @see JComponent#revalidate
* @see JComponent#isValidateRoot
* @see java.awt.Container#isValidateRoot
*/
@Override
+ @BeanProperty(hidden = true)
public boolean isValidateRoot() {
return true;
}
*** 487,505 ****
*
* @param policy one of the three values listed above
* @exception IllegalArgumentException if <code>policy</code>
* is not one of the legal values shown above
* @see #getVerticalScrollBarPolicy
- *
- * @beaninfo
- * preferred: true
- * bound: true
- * description: The scrollpane vertical scrollbar policy
- * enum: VERTICAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
- * VERTICAL_SCROLLBAR_NEVER ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
- * VERTICAL_SCROLLBAR_ALWAYS ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
*/
public void setVerticalScrollBarPolicy(int policy) {
switch (policy) {
case VERTICAL_SCROLLBAR_AS_NEEDED:
case VERTICAL_SCROLLBAR_NEVER:
case VERTICAL_SCROLLBAR_ALWAYS:
--- 475,490 ----
*
* @param policy one of the three values listed above
* @exception IllegalArgumentException if <code>policy</code>
* is not one of the legal values shown above
* @see #getVerticalScrollBarPolicy
*/
+ @BeanProperty(preferred = true, enumerationValues = {
+ "ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED",
+ "ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER",
+ "ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS"}, description
+ = "The scrollpane vertical scrollbar policy")
public void setVerticalScrollBarPolicy(int policy) {
switch (policy) {
case VERTICAL_SCROLLBAR_AS_NEEDED:
case VERTICAL_SCROLLBAR_NEVER:
case VERTICAL_SCROLLBAR_ALWAYS:
*** 535,553 ****
*
* @param policy one of the three values listed above
* @exception IllegalArgumentException if <code>policy</code>
* is not one of the legal values shown above
* @see #getHorizontalScrollBarPolicy
- *
- * @beaninfo
- * preferred: true
- * bound: true
- * description: The scrollpane scrollbar policy
- * enum: HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
- * HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
- * HORIZONTAL_SCROLLBAR_ALWAYS ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
*/
public void setHorizontalScrollBarPolicy(int policy) {
switch (policy) {
case HORIZONTAL_SCROLLBAR_AS_NEEDED:
case HORIZONTAL_SCROLLBAR_NEVER:
case HORIZONTAL_SCROLLBAR_ALWAYS:
--- 520,535 ----
*
* @param policy one of the three values listed above
* @exception IllegalArgumentException if <code>policy</code>
* is not one of the legal values shown above
* @see #getHorizontalScrollBarPolicy
*/
+ @BeanProperty(preferred = true, enumerationValues = {
+ "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED",
+ "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER",
+ "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS"}, description
+ = "The scrollpane scrollbar policy")
public void setHorizontalScrollBarPolicy(int policy) {
switch (policy) {
case HORIZONTAL_SCROLLBAR_AS_NEEDED:
case HORIZONTAL_SCROLLBAR_NEVER:
case HORIZONTAL_SCROLLBAR_ALWAYS:
*** 585,600 ****
* and feel implementation.
*
* @param viewportBorder the border to be added
* @see #getViewportBorder
* @see #setViewport
- *
- * @beaninfo
- * preferred: true
- * bound: true
- * description: The border around the viewport.
*/
public void setViewportBorder(Border viewportBorder) {
Border oldValue = this.viewportBorder;
this.viewportBorder = viewportBorder;
firePropertyChange("viewportBorder", oldValue, viewportBorder);
}
--- 567,579 ----
* and feel implementation.
*
* @param viewportBorder the border to be added
* @see #getViewportBorder
* @see #setViewport
*/
+ @BeanProperty(preferred = true, description
+ = "The border around the viewport.")
public void setViewportBorder(Border viewportBorder) {
Border oldValue = this.viewportBorder;
this.viewportBorder = viewportBorder;
firePropertyChange("viewportBorder", oldValue, viewportBorder);
}
*** 603,612 ****
--- 582,592 ----
/**
* Returns the bounds of the viewport's border.
*
* @return a <code>Rectangle</code> object specifying the viewport border
*/
+ @BeanProperty(bound = false)
public Rectangle getViewportBorderBounds()
{
Rectangle borderR = new Rectangle(getSize());
Insets insets = getInsets();
*** 838,853 ****
* horizontal and vertical scrollbars by default.
*
* @param horizontalScrollBar the horizontal scrollbar to be added
* @see #createHorizontalScrollBar
* @see #getHorizontalScrollBar
- *
- * @beaninfo
- * expert: true
- * bound: true
- * description: The horizontal scrollbar.
*/
public void setHorizontalScrollBar(JScrollBar horizontalScrollBar) {
JScrollBar old = getHorizontalScrollBar();
this.horizontalScrollBar = horizontalScrollBar;
if (horizontalScrollBar != null) {
add(horizontalScrollBar, HORIZONTAL_SCROLLBAR);
--- 818,830 ----
* horizontal and vertical scrollbars by default.
*
* @param horizontalScrollBar the horizontal scrollbar to be added
* @see #createHorizontalScrollBar
* @see #getHorizontalScrollBar
*/
+ @BeanProperty(expert = true, description
+ = "The horizontal scrollbar.")
public void setHorizontalScrollBar(JScrollBar horizontalScrollBar) {
JScrollBar old = getHorizontalScrollBar();
this.horizontalScrollBar = horizontalScrollBar;
if (horizontalScrollBar != null) {
add(horizontalScrollBar, HORIZONTAL_SCROLLBAR);
*** 897,912 ****
* horizontal scrollbars by default.
*
* @param verticalScrollBar the new vertical scrollbar to be added
* @see #createVerticalScrollBar
* @see #getVerticalScrollBar
- *
- * @beaninfo
- * expert: true
- * bound: true
- * description: The vertical scrollbar.
*/
public void setVerticalScrollBar(JScrollBar verticalScrollBar) {
JScrollBar old = getVerticalScrollBar();
this.verticalScrollBar = verticalScrollBar;
add(verticalScrollBar, VERTICAL_SCROLLBAR);
firePropertyChange("verticalScrollBar", old, verticalScrollBar);
--- 874,886 ----
* horizontal scrollbars by default.
*
* @param verticalScrollBar the new vertical scrollbar to be added
* @see #createVerticalScrollBar
* @see #getVerticalScrollBar
*/
+ @BeanProperty(expert = true, description
+ = "The vertical scrollbar.")
public void setVerticalScrollBar(JScrollBar verticalScrollBar) {
JScrollBar old = getVerticalScrollBar();
this.verticalScrollBar = verticalScrollBar;
add(verticalScrollBar, VERTICAL_SCROLLBAR);
firePropertyChange("verticalScrollBar", old, verticalScrollBar);
*** 957,974 ****
* <code>null</code>, the old viewport is still removed
* and the new viewport is set to <code>null</code>
* @see #createViewport
* @see #getViewport
* @see #setViewportView
- *
- * @beaninfo
- * expert: true
- * bound: true
- * attribute: visualUpdate true
- * description: The viewport child for this scrollpane
- *
*/
public void setViewport(JViewport viewport) {
JViewport old = getViewport();
this.viewport = viewport;
if (viewport != null) {
add(viewport, VIEWPORT);
--- 931,943 ----
* <code>null</code>, the old viewport is still removed
* and the new viewport is set to <code>null</code>
* @see #createViewport
* @see #getViewport
* @see #setViewportView
*/
+ @BeanProperty(expert = true, visualUpdate = true, description
+ = "The viewport child for this scrollpane")
public void setViewport(JViewport viewport) {
JViewport old = getViewport();
this.viewport = viewport;
if (viewport != null) {
add(viewport, VIEWPORT);
*** 1036,1051 ****
* @param rowHeader the new row header to be used; if <code>null</code>
* the old row header is still removed and the new rowHeader
* is set to <code>null</code>
* @see #getRowHeader
* @see #setRowHeaderView
- *
- * @beaninfo
- * bound: true
- * expert: true
- * description: The row header child for this scrollpane
*/
public void setRowHeader(JViewport rowHeader) {
JViewport old = getRowHeader();
this.rowHeader = rowHeader;
if (rowHeader != null) {
add(rowHeader, ROW_HEADER);
--- 1005,1017 ----
* @param rowHeader the new row header to be used; if <code>null</code>
* the old row header is still removed and the new rowHeader
* is set to <code>null</code>
* @see #getRowHeader
* @see #setRowHeaderView
*/
+ @BeanProperty(expert = true, description
+ = "The row header child for this scrollpane")
public void setRowHeader(JViewport rowHeader) {
JViewport old = getRowHeader();
this.rowHeader = rowHeader;
if (rowHeader != null) {
add(rowHeader, ROW_HEADER);
*** 1103,1118 ****
* to add a column header component and its viewport to the scroll pane.
*
* @param columnHeader a {@code JViewport} which is the new column header
* @see #getColumnHeader
* @see #setColumnHeaderView
- *
- * @beaninfo
- * bound: true
- * description: The column header child for this scrollpane
- * attribute: visualUpdate true
*/
public void setColumnHeader(JViewport columnHeader) {
JViewport old = getColumnHeader();
this.columnHeader = columnHeader;
if (columnHeader != null) {
add(columnHeader, COLUMN_HEADER);
--- 1069,1081 ----
* to add a column header component and its viewport to the scroll pane.
*
* @param columnHeader a {@code JViewport} which is the new column header
* @see #getColumnHeader
* @see #setColumnHeaderView
*/
+ @BeanProperty(visualUpdate = true, description
+ = "The column header child for this scrollpane")
public void setColumnHeader(JViewport columnHeader) {
JViewport old = getColumnHeader();
this.columnHeader = columnHeader;
if (columnHeader != null) {
add(columnHeader, COLUMN_HEADER);
*** 1301,1314 ****
* mouse wheel. Wheel scrolling is enabled by default.
*
* @return true if mouse wheel scrolling is enabled, false otherwise
* @see #setWheelScrollingEnabled
* @since 1.4
- * @beaninfo
- * bound: true
- * description: Flag for enabling/disabling mouse wheel scrolling
*/
public boolean isWheelScrollingEnabled() {return wheelScrollState;}
/**
* Enables/disables scrolling in response to movement of the mouse wheel.
* Wheel scrolling is enabled by default.
--- 1264,1276 ----
* mouse wheel. Wheel scrolling is enabled by default.
*
* @return true if mouse wheel scrolling is enabled, false otherwise
* @see #setWheelScrollingEnabled
* @since 1.4
*/
+ @BeanProperty(description
+ = "Flag for enabling/disabling mouse wheel scrolling")
public boolean isWheelScrollingEnabled() {return wheelScrollState;}
/**
* Enables/disables scrolling in response to movement of the mouse wheel.
* Wheel scrolling is enabled by default.
*** 1318,1331 ****
* <code>false</code> otherwise.
* @see #isWheelScrollingEnabled
* @see java.awt.event.MouseWheelEvent
* @see java.awt.event.MouseWheelListener
* @since 1.4
- * @beaninfo
- * bound: true
- * description: Flag for enabling/disabling mouse wheel scrolling
*/
public void setWheelScrollingEnabled(boolean handleWheel) {
boolean old = wheelScrollState;
wheelScrollState = handleWheel;
firePropertyChange("wheelScrollingEnabled", old, handleWheel);
}
--- 1280,1292 ----
* <code>false</code> otherwise.
* @see #isWheelScrollingEnabled
* @see java.awt.event.MouseWheelEvent
* @see java.awt.event.MouseWheelListener
* @since 1.4
*/
+ @BeanProperty(description
+ = "Flag for enabling/disabling mouse wheel scrolling")
public void setWheelScrollingEnabled(boolean handleWheel) {
boolean old = wheelScrollState;
wheelScrollState = handleWheel;
firePropertyChange("wheelScrollingEnabled", old, handleWheel);
}
*** 1422,1431 ****
--- 1383,1393 ----
* A new AccessibleJScrollPane instance is created if necessary.
*
* @return an AccessibleJScrollPane that serves as the
* AccessibleContext of this JScrollPane
*/
+ @BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJScrollPane();
}
return accessibleContext;