edu.neu.ccs.gui
Class JPTScrollPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--edu.neu.ccs.gui.JPTScrollPane
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, ScrollPaneConstants, Serializable
Direct Known Subclasses:
ScrollableDisplay

public class JPTScrollPane
extends JScrollPane

Class JPTScrollPane extends JScrollPane by adding methods that help control the preferred size of the JViewport window.

Since:
1.0
See Also:
Serialized Form

Field Summary
 
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
JPTScrollPane()
          Creates an empty (no viewport view) JPTScrollPane where both horizontal and vertical scrollbars appear when needed.
JPTScrollPane(Component view)
          Creates a JPTScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
JPTScrollPane(Component view, int vsbPolicy, int hsbPolicy)
          Creates a JPTScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars that are displayed in accordance with the scrollbar policies.
JPTScrollPane(int vsbPolicy, int hsbPolicy)
          Creates an empty (no viewport view) JPTScrollPane whose scrollbars are displayed in accordance with the scrollbar policies.
 
Method Summary
 void boundViewportPreferredSize(Dimension d)
          Bounds the preferred size of the scrollpane's viewport to be no larger than the given Dimension.
 void boundViewportPreferredSize(int width, int height)
          Bounds the preferred size of the scrollpane's viewport to be no larger than the given width and height.
 void setViewportPreferredSize(Dimension d)
          Sets the preferred size of the scrollpane's viewport to the given Dimension.
 void setViewportPreferredSize(int width, int height)
          Sets the preferred size of the scrollpane's viewport to the given width and height.
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JPTScrollPane

public JPTScrollPane()

Creates an empty (no viewport view) JPTScrollPane where both horizontal and vertical scrollbars appear when needed.

See Also:
JPTScrollPane(Component), JPTScrollPane(int, int), JPTScrollPane(Component, int, int)

JPTScrollPane

public JPTScrollPane(Component view)

Creates a JPTScrollPane that 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:
JPTScrollPane(), JPTScrollPane(int, int), JPTScrollPane(Component, int, int)

JPTScrollPane

public JPTScrollPane(int vsbPolicy,
                     int hsbPolicy)

Creates an empty (no viewport view) JPTScrollPane whose scrollbars are displayed in accordance with the scrollbar policies.

Parameters:
vsbPolicy - an integer that specifies the vertical scrollbar policy
hsbPolicy - an integer that specifies the horizontal scrollbar policy
See Also:
JPTScrollPane(), JPTScrollPane(Component), JPTScrollPane(Component, int, int), JScrollPane.setVerticalScrollBarPolicy(int), JScrollPane.setHorizontalScrollBarPolicy(int)

JPTScrollPane

public JPTScrollPane(Component view,
                     int vsbPolicy,
                     int hsbPolicy)

Creates a JPTScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars that are displayed in accordance with the scrollbar policies.

Parameters:
view - the component to display in the scrollpane's viewport
vsbPolicy - an integer that specifies the vertical scrollbar policy
hsbPolicy - an integer that specifies the horizontal scrollbar policy
See Also:
JPTScrollPane(), JPTScrollPane(Component), JPTScrollPane(int, int), JScrollPane.setVerticalScrollBarPolicy(int), JScrollPane.setHorizontalScrollBarPolicy(int)
Method Detail

setViewportPreferredSize

public void setViewportPreferredSize(Dimension d)

Sets the preferred size of the scrollpane's viewport to the given Dimension.

Does nothing if:

If the scrollpane's viewport is changed after this call then this call will have no further effect.

Parameters:
d - the desired preferred size of the scrollpane's viewport
See Also:
setViewportPreferredSize(int, int)

setViewportPreferredSize

public void setViewportPreferredSize(int width,
                                     int height)

Sets the preferred size of the scrollpane's viewport to the given width and height.

Does nothing if:

If the scrollpane's viewport is changed after this call then this call will have no further effect.

Parameters:
width - the desired preferred width of the scrollpane's viewport
height - the desired preferred height of the scrollpane's viewport
See Also:
setViewportPreferredSize(Dimension)

boundViewportPreferredSize

public void boundViewportPreferredSize(Dimension d)

Bounds the preferred size of the scrollpane's viewport to be no larger than the given Dimension.

Operationally, this method calls setViewportPreferredSize with a dimension that is the minimum of the given dimension and the preferred size of the viewport's view.

Does nothing if:

If the scrollpane's viewport is changed after this call then this call will have no further effect.

Parameters:
d - the desired preferred bound for the scrollpane's viewport
See Also:
setViewportPreferredSize(Dimension), boundViewportPreferredSize(int, int), DimensionUtilities.min(Dimension, Dimension)

boundViewportPreferredSize

public void boundViewportPreferredSize(int width,
                                       int height)

Bounds the preferred size of the scrollpane's viewport to be no larger than the given width and height.

Operationally, this method calls setViewportPreferredSize with a dimension that is the minimum of the given dimension and the preferred size of the viewport's view.

Does nothing if:

If the scrollpane's viewport is changed after this call then this call will have no further effect.

See Also:
setViewportPreferredSize(int, int), boundViewportPreferredSize(Dimension), DimensionUtilities.min(Dimension, Dimension)