DefaultTreeCellEditor.DefaultTextField
, JEditorPane
, JFormattedTextField
, JLayer
, JList
, JPasswordField
, JTable
, JTextArea
, JTextComponent
, JTextField
, JTextPane
, JTree
public interface Scrollable
Modifier and Type | Method | Description |
---|---|---|
Dimension |
getPreferredScrollableViewportSize() |
Returns the preferred size of the viewport for a view component. |
int |
getScrollableBlockIncrement |
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight() |
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth() |
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
int |
getScrollableUnitIncrement |
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
Dimension getPreferredScrollableViewportSize()
JList
component is the size required to accommodate all of the cells in its list. However, the value of preferredScrollableViewportSize
is the size required for JList.getVisibleRowCount
rows. A component without any properties that would affect the viewport size should just return getPreferredSize
here.JViewport
whose view is this Scrollable
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.boolean getScrollableTracksViewportWidth()
Scrollable
to match the width of the viewport. For example a normal text view that supported line wrapping would return true here, since it would be undesirable for wrapped lines to disappear beyond the right edge of the viewport. Note that returning true for a Scrollable whose ancestor is a JScrollPane effectively disables horizontal scrolling. Scrolling containers, like JViewport, will use this method each time they are validated.
boolean getScrollableTracksViewportHeight()
Scrolling containers, like JViewport, will use this method each time they are validated.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/Scrollable.html