edu.umd.cs.piccolox.swing
Class PScrollPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by edu.umd.cs.piccolox.swing.PScrollPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants

public class PScrollPane
extends JScrollPane

A simple extension to a standard scroll pane that uses the jazz version of the viewport by default. Also uses the jazz version of ScrollPaneLayout

Author:
Lance Good
See Also:
Serialized Form

Nested Class Summary
protected static class PScrollPane.PNullAction
          An action to do nothing - put into an action map to keep it from looking to its parent.
protected static class PScrollPane.PScrollAction
          Action to scroll left/right/up/down.
protected static class PScrollPane.PScrollEndAction
          Action to scroll to last visible location.
 
Nested classes/interfaces inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean disableKeyActions
          Controls whether key actions are disabled on this component.
protected  PScrollPane.PNullAction nullAction
          A reusable null action.
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields 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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PScrollPane()
          Constructs a scroll pane not attached to any component.
PScrollPane(Component view)
          Constructs a scroll pane for the provided component.
PScrollPane(Component view, int vsbPolicy, int hsbPolicy)
          Constructs a scollpane for the provided component with the specified scrollbar policies.
PScrollPane(int vsbPolicy, int hsbPolicy)
          Constructs a scroll pane not attached to any component with the specified scroll bar policies.
 
Method Summary
protected  JViewport createViewport()
          Overridden to create the Piccolo2D viewport.
protected  void disableKeyActions()
          Disables key actions on this PScrollPane.
protected  void installCustomKeyActions()
          Install custom key actions (in place of the Swing defaults) to correctly scroll the view.
 void setHorizontalScrollBar(JScrollBar newHorizontalScrollBar)
          Intercepts the horizontal scroll bar setter to ensure that the adjustment listener is installed appropriately.
 void setKeyActionsDisabled(boolean disable)
          Disable or enable key actions on this PScrollPane.
 void setUI(ScrollPaneUI ui)
          Sets the UI.
 void setVerticalScrollBar(JScrollBar newVerticalScrollBar)
          Intercepts the vertical scroll bar setter to ensure that the adjustment listener is installed appropriately.
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, update
 
Methods 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, validateTree
 
Methods 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nullAction

protected PScrollPane.PNullAction nullAction
A reusable null action.


disableKeyActions

protected boolean disableKeyActions
Controls whether key actions are disabled on this component.

Constructor Detail

PScrollPane

public PScrollPane(Component view,
                   int vsbPolicy,
                   int hsbPolicy)
Constructs a scollpane for the provided component with the specified scrollbar policies.

Parameters:
view - component being viewed through the scrollpane
vsbPolicy - vertical scroll bar policy
hsbPolicy - horizontal scroll bar policy

PScrollPane

public PScrollPane(Component view)
Constructs a scroll pane for the provided component.

Parameters:
view - component being viewed through the scroll pane

PScrollPane

public PScrollPane(int vsbPolicy,
                   int hsbPolicy)
Constructs a scroll pane not attached to any component with the specified scroll bar policies.

Parameters:
vsbPolicy - vertical scroll bar policy
hsbPolicy - horizontal scroll bar policy

PScrollPane

public PScrollPane()
Constructs a scroll pane not attached to any component.

Method Detail

setVerticalScrollBar

public void setVerticalScrollBar(JScrollBar newVerticalScrollBar)
Intercepts the vertical scroll bar setter to ensure that the adjustment listener is installed appropriately.

Overrides:
setVerticalScrollBar in class JScrollPane
Parameters:
newVerticalScrollBar - the new vertical scroll bar to use with this PScrollPane

setHorizontalScrollBar

public void setHorizontalScrollBar(JScrollBar newHorizontalScrollBar)
Intercepts the horizontal scroll bar setter to ensure that the adjustment listener is installed appropriately.

Overrides:
setHorizontalScrollBar in class JScrollPane
Parameters:
newHorizontalScrollBar - the new horizontal scroll bar to use with this PScrollPane

setKeyActionsDisabled

public void setKeyActionsDisabled(boolean disable)
Disable or enable key actions on this PScrollPane.

Parameters:
disable - true disables key actions, false enables key actions

setUI

public void setUI(ScrollPaneUI ui)
Sets the UI.

Overrides:
setUI in class JScrollPane
Parameters:
ui - the scroll pane UI to associate with this PScollPane

installCustomKeyActions

protected void installCustomKeyActions()
Install custom key actions (in place of the Swing defaults) to correctly scroll the view.


disableKeyActions

protected void disableKeyActions()
Disables key actions on this PScrollPane.


createViewport

protected JViewport createViewport()
Overridden to create the Piccolo2D viewport.

Overrides:
createViewport in class JScrollPane
Returns:
the Piccolo2D version of the viewport


Copyright © 1995-2010 Piccolo2D. All Rights Reserved.