public class ScrollablePanel extends JPanel implements Scrollable, SwingConstants
Scrollable amounts can be specifed as a percentage of the viewport size or as an actual pixel value. The amount can be changed for both unit and block scrolling for both horizontal and vertical scrollbars.
The Scrollable interface only provides a boolean value for determining whether or not the viewport size (width or height) should be used by the scrollpane when determining if scrollbars should be made visible. This class supports the concept of dynamically changing this value based on the size of the viewport. In this case the viewport size will only be used when it is larger than the panels size. This has the effect of ensuring the viewport is always full as components added to the panel will be size to fill the area available, based on the rules of the applicable layout manager of course.
| Modifier and Type | Class and Description |
|---|---|
static class |
ScrollablePanel.IncrementType
DOCUMENT ME!
|
static class |
ScrollablePanel.ScrollableSizeHint
DOCUMENT ME!
|
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategylistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
ScrollablePanel()
Default constructor that uses a FlowLayout.
|
ScrollablePanel(LayoutManager layout)
Constuctor for specifying the LayoutManager of the panel.
|
| Modifier and Type | Method and Description |
|---|---|
Dimension |
getPreferredScrollableViewportSize() |
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo |
getScrollableBlockIncrement(int orientation)
Get the block IncrementInfo for the specified orientation.
|
int |
getScrollableBlockIncrement(Rectangle visible,
int orientation,
int direction) |
ScrollablePanel.ScrollableSizeHint |
getScrollableHeight()
Get the height ScrollableSizeHint enum.
|
protected int |
getScrollableIncrement(de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info,
int distance)
DOCUMENT ME!
|
boolean |
getScrollableTracksViewportHeight() |
boolean |
getScrollableTracksViewportWidth() |
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo |
getScrollableUnitIncrement(int orientation)
Get the unit IncrementInfo for the specified orientation.
|
int |
getScrollableUnitIncrement(Rectangle visible,
int orientation,
int direction) |
ScrollablePanel.ScrollableSizeHint |
getScrollableWidth()
Get the width ScrollableSizeHint enum.
|
void |
setScrollableBlockIncrement(int orientation,
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info)
Specify the information needed to do block scrolling.
|
void |
setScrollableBlockIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
Specify the information needed to do block scrolling.
|
void |
setScrollableHeight(ScrollablePanel.ScrollableSizeHint scrollableHeight)
Set the ScrollableSizeHint enum for the height.
|
void |
setScrollableUnitIncrement(int orientation,
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info)
Specify the information needed to do unit scrolling.
|
void |
setScrollableUnitIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
Specify the information needed to do unit scrolling.
|
void |
setScrollableWidth(ScrollablePanel.ScrollableSizeHint scrollableWidth)
Set the ScrollableSizeHint enum for the width.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic ScrollablePanel()
public ScrollablePanel(LayoutManager layout)
layout - the LayountManger for the panelpublic ScrollablePanel.ScrollableSizeHint getScrollableHeight()
public void setScrollableHeight(ScrollablePanel.ScrollableSizeHint scrollableHeight)
ScrollableSizeHint.NONE - return "false", which causes the height of the panel to be used when laying out the children ScrollableSizeHint.FIT - return "true", which causes the height of the viewport to be used when laying out the children ScrollableSizeHint.STRETCH - return "true" when the viewport height is greater than the height of the panel, "false" otherwise.
scrollableHeight - as represented by the ScrollableSizeHint enum.public ScrollablePanel.ScrollableSizeHint getScrollableWidth()
public void setScrollableWidth(ScrollablePanel.ScrollableSizeHint scrollableWidth)
ScrollableSizeHint.NONE - return "false", which causes the width of the panel to be used when laying out the children ScrollableSizeHint.FIT - return "true", which causes the width of the viewport to be used when laying out the children ScrollableSizeHint.STRETCH - return "true" when the viewport width is greater than the width of the panel, "false" otherwise.
scrollableWidth - as represented by the ScrollableSizeHint enum.public de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo getScrollableBlockIncrement(int orientation)
orientation - DOCUMENT ME!public void setScrollableBlockIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
orientation - specify the scrolling orientation. Must be either: SwingContants.HORIZONTAL or
SwingContants.VERTICAL.type - DOCUMENT ME!amount - a value used with the IncrementType to determine the scrollable amountpublic void setScrollableBlockIncrement(int orientation,
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info)
orientation - specify the scrolling orientation. Must be either: SwingContants.HORIZONTAL or
SwingContants.VERTICAL.info - An IncrementInfo object containing information of how to calculate the scrollable amount.IllegalArgumentException - DOCUMENT ME!public de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo getScrollableUnitIncrement(int orientation)
orientation - DOCUMENT ME!public void setScrollableUnitIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
orientation - specify the scrolling orientation. Must be either: SwingContants.HORIZONTAL or
SwingContants.VERTICAL.type - DOCUMENT ME!amount - a value used with the IncrementType to determine the scrollable amountpublic void setScrollableUnitIncrement(int orientation,
de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info)
orientation - specify the scrolling orientation. Must be either: SwingContants.HORIZONTAL or
SwingContants.VERTICAL.info - An IncrementInfo object containing information of how to calculate the scrollable amount.IllegalArgumentException - DOCUMENT ME!public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface Scrollablepublic int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction)
getScrollableUnitIncrement in interface Scrollablepublic int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction)
getScrollableBlockIncrement in interface Scrollableprotected int getScrollableIncrement(de.cismet.cids.custom.commons.gui.ScrollablePanel.IncrementInfo info,
int distance)
info - DOCUMENT ME!distance - DOCUMENT ME!public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface ScrollableCopyright © 2012–2025 cismet GmbH. All rights reserved.