-
- All Known Implementing Classes:
- DefaultTreeCellEditor.DefaultTextField, JEditorPane, JFormattedTextField, JLayer, JList, JPasswordField, JTable, JTextArea, JTextComponent, JTextField, JTextPane, JTree
public interface Scrollable
An interface that provides information to a scrolling container like JScrollPane. A complex component that's likely to be used as a viewing a JScrollPane viewport (or other scrolling container) should implement this interface.- See Also:
JViewport
,JScrollPane
,JScrollBar
-
-
Method Summary
Methods Modifier and Type Method and Description Dimension
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component.int
getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
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 thisScrollable
to match the width of the viewport.int
getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
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.
-
-
-
Method Detail
-
getPreferredScrollableViewportSize
Dimension getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. For example, the preferred size of aJList
component is the size required to accommodate all of the cells in its list. However, the value ofpreferredScrollableViewportSize
is the size required forJList.getVisibleRowCount
rows. A component without any properties that would affect the viewport size should just returngetPreferredSize
here.- Returns:
- the preferredSize of a
JViewport
whose view is thisScrollable
- See Also:
JComponent.getPreferredSize()
-
getScrollableUnitIncrement
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
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. Ideally, components should handle a partially exposed row or column by returning the distance required to completely expose the item.Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
- Parameters:
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.- Returns:
- The "unit" increment for scrolling in the specified direction. This value should always be positive.
- See Also:
JScrollBar.setUnitIncrement(int)
-
getScrollableBlockIncrement
int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
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.Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
- Parameters:
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.- Returns:
- The "block" increment for scrolling in the specified direction. This value should always be positive.
- See Also:
JScrollBar.setBlockIncrement(int)
-
getScrollableTracksViewportWidth
boolean getScrollableTracksViewportWidth()
Return true if a viewport should always force the width of thisScrollable
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.
- Returns:
- True if a viewport should force the Scrollables width to match its own.
-
getScrollableTracksViewportHeight
boolean getScrollableTracksViewportHeight()
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. For example a columnar text view that flowed text in left to right columns could effectively disable vertical scrolling by returning true here.Scrolling containers, like JViewport, will use this method each time they are validated.
- Returns:
- True if a viewport should force the Scrollables height to match its own.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/scrollable.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.