public class ScrollablePanel extends JPanel implements Scrollable, SwingConstants
http://tips4java.wordpress.com/2009/12/20/scrollable-panel/
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ScrollablePanel.IncrementInfo
Helper class to hold the information required to calculate the scroll
amount.
|
static class |
ScrollablePanel.IncrementType |
static class |
ScrollablePanel.ScrollableSizeHint |
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
private ScrollablePanel.IncrementInfo |
horizontalBlock |
private ScrollablePanel.IncrementInfo |
horizontalUnit |
private ScrollablePanel.ScrollableSizeHint |
scrollableHeight |
private ScrollablePanel.ScrollableSizeHint |
scrollableWidth |
private static long |
serialVersionUID
The UID for serialization.
|
private ScrollablePanel.IncrementInfo |
verticalBlock |
private ScrollablePanel.IncrementInfo |
verticalUnit |
listenerList, 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() |
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(ScrollablePanel.IncrementInfo info,
int distance) |
boolean |
getScrollableTracksViewportHeight() |
boolean |
getScrollableTracksViewportWidth() |
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,
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,
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, transferFocusUpCycleprivate static final long serialVersionUID
private ScrollablePanel.ScrollableSizeHint scrollableHeight
private ScrollablePanel.ScrollableSizeHint scrollableWidth
private ScrollablePanel.IncrementInfo horizontalBlock
private ScrollablePanel.IncrementInfo horizontalUnit
private ScrollablePanel.IncrementInfo verticalBlock
private ScrollablePanel.IncrementInfo verticalUnit
public ScrollablePanel()
public ScrollablePanel(LayoutManager layout)
layout - the LayountManger for the panelpublic ScrollablePanel.ScrollableSizeHint getScrollableHeight()
public void setScrollableHeight(ScrollablePanel.ScrollableSizeHint scrollableHeight)
scrollableHeight - as represented by the ScrollableSizeHint enum.public ScrollablePanel.ScrollableSizeHint getScrollableWidth()
public void setScrollableWidth(ScrollablePanel.ScrollableSizeHint scrollableWidth)
scrollableWidth - as represented by the ScrollableSizeHint enum.public ScrollablePanel.IncrementInfo getScrollableBlockIncrement(int orientation)
public void setScrollableBlockIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
orientation - specify the scrolling orientation. Must be either:
SwingContants.HORIZONTAL or SwingContants.VERTICAL.type - specify how the amount parameter in the calculation of the
scrollable amount. Valid values are: IncrementType.PERCENT - treat
the amount as a % of the viewport size IncrementType.PIXEL - treat
the amount as the scrollable amountamount - a value used with the IncrementType to determine the
scrollable amountpublic void setScrollableBlockIncrement(int orientation,
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.public ScrollablePanel.IncrementInfo getScrollableUnitIncrement(int orientation)
public void setScrollableUnitIncrement(int orientation,
ScrollablePanel.IncrementType type,
int amount)
orientation - specify the scrolling orientation. Must be either:
SwingContants.HORIZONTAL or SwingContants.VERTICAL.type - specify how the amount parameter in the calculation of the
scrollable amount. Valid values are: IncrementType.PERCENT - treat
the amount as a % of the viewport size IncrementType.PIXEL - treat
the amount as the scrollable amountamount - a value used with the IncrementType to determine the
scrollable amountpublic void setScrollableUnitIncrement(int orientation,
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.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(ScrollablePanel.IncrementInfo info, int distance)
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface ScrollableCopyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.