Package com.jidesoft.swing
Class SimpleScrollPane
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JScrollPane
com.jidesoft.swing.SimpleScrollPane
- All Implemented Interfaces:
MouseWheelListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,ScrollPaneConstants
SimpleScrollPane is a special scroll pane. There is no scroll bar. It just uses four scroll buttons to
do the scrolling.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe scroll button for SimpleScrollPane.Nested classes/interfaces inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBarNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewportFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty (no viewport view)JideScrollPanewhere both horizontal and vertical scrollbars appear when needed.SimpleScrollPane(int vsbPolicy, int hsbPolicy) Creates an empty (no viewport view)JideScrollPanewith specified scrollbar policies.SimpleScrollPane(Component view) Creates aJideScrollPanethat displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.SimpleScrollPane(Component view, int vsbPolicy, int hsbPolicy) Creates aJideScrollPanethat displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractButtoncreateScrollButton(int type) Creates the scroll button.intintGets the delay in ms between each unit scrolling.intbooleanChecks if the scroll button scrolls on rollover.voidvoidvoidsetHorizontalUnitIncrement(int horizontalUnitIncrement) voidsetRepeatDelay(int repeatDelay) Sets the delay in ms between each unit scrolling.voidsetScrollDownButton(AbstractButton scrollDownButton) voidsetScrollLeftButton(AbstractButton scrollLeftButton) voidsetScrollOnRollover(boolean scrollOnRollover) Sets scroll on rollover.voidsetScrollRightButton(AbstractButton scrollRightButton) voidsetScrollUpButton(AbstractButton scrollUpButton) voidsetVerticalUnitIncrement(int verticalUnitIncrement) voidsetWheelScrollingEnabled(boolean handleWheel) voidprotected voidvoidupdateUI()Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportViewMethods inherited from class javax.swing.JComponent
addAncestorListener, 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, 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, updateMethods inherited from class java.awt.Container
add, 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, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
SCROLL_UP_BUTTON
- See Also:
-
SCROLL_DOWN_BUTTON
- See Also:
-
SCROLL_LEFT_BUTTON
- See Also:
-
SCROLL_RIGHT_BUTTON
- See Also:
-
-
Constructor Details
-
SimpleScrollPane
Creates aJideScrollPanethat displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, ifvsbPolicyisVERTICAL_SCROLLBAR_AS_NEEDEDthen the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed atJScrollPane.setVerticalScrollBarPolicy(int)andJScrollPane.setHorizontalScrollBarPolicy(int).- Parameters:
view- the component to display in the scrollpanes viewportvsbPolicy- an integer that specifies the vertical scrollbar policyhsbPolicy- an integer that specifies the horizontal scrollbar policy- See Also:
-
SimpleScrollPane
Creates aJideScrollPanethat displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.- Parameters:
view- the component to display in the scrollpane's viewport- See Also:
-
SimpleScrollPane
public SimpleScrollPane(int vsbPolicy, int hsbPolicy) Creates an empty (no viewport view)JideScrollPanewith specified scrollbar policies. The available policy settings are listed atJScrollPane.setVerticalScrollBarPolicy(int)andJScrollPane.setHorizontalScrollBarPolicy(int).- Parameters:
vsbPolicy- an integer that specifies the vertical scrollbar policyhsbPolicy- an integer that specifies the horizontal scrollbar policy- See Also:
-
SimpleScrollPane
public SimpleScrollPane()Creates an empty (no viewport view)JideScrollPanewhere both horizontal and vertical scrollbars appear when needed.
-
-
Method Details
-
updateUI
public void updateUI()- Overrides:
updateUIin classJScrollPane
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-
getScrollUpButton
-
setScrollUpButton
-
getScrollDownButton
-
setScrollDownButton
-
getScrollLeftButton
-
setScrollLeftButton
-
getScrollRightButton
-
setScrollRightButton
-
createScrollButton
Creates the scroll button. You can override this method to change the attributes on the button. For example, you can do this to create a bigger scroll button.SimpleScrollPane pane = new SimpleScrollPane(){ protected AbstractButton createScrollButton(int type) { AbstractButton scrollButton = super.createScrollButton(type); scrollButton.setPreferredSize(new Dimension(20, 20)); return scrollButton; } };- Parameters:
type- the type of the scroll button. It could beSwingConstants.NORTH,SwingConstants.SOUTH,SwingConstants.WESTorSwingConstants.EAST.- Returns:
- the scroll button.
-
updateButtonState
protected void updateButtonState() -
scroll
-
getViewportBorderBounds
- Overrides:
getViewportBorderBoundsin classJScrollPane
-
getHorizontalUnitIncrement
public int getHorizontalUnitIncrement() -
setHorizontalUnitIncrement
public void setHorizontalUnitIncrement(int horizontalUnitIncrement) -
getVerticalUnitIncrement
public int getVerticalUnitIncrement() -
setVerticalUnitIncrement
public void setVerticalUnitIncrement(int verticalUnitIncrement) -
isScrollOnRollover
public boolean isScrollOnRollover()Checks if the scroll button scrolls on rollover.- Returns:
- true if it scrolls on rollover.
-
setScrollOnRollover
public void setScrollOnRollover(boolean scrollOnRollover) Sets scroll on rollover. If true, the scrolling will start when mouse is placed above the scroll button. If false, the scrolling will start only when you click or press and hold the mouse button.- Parameters:
scrollOnRollover- true or false.
-
getRepeatDelay
public int getRepeatDelay()Gets the delay in ms between each unit scrolling.- Returns:
- the delay.
-
setRepeatDelay
public void setRepeatDelay(int repeatDelay) Sets the delay in ms between each unit scrolling. By default, it's 50. The big thenumberr, the slow the scrolling.- Parameters:
repeatDelay- the new repeat delay.
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-
setWheelScrollingEnabled
public void setWheelScrollingEnabled(boolean handleWheel) - Overrides:
setWheelScrollingEnabledin classJScrollPane
-