edu.neu.ccs.gui
Class JPTScrollPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JScrollPane
                  extended byedu.neu.ccs.gui.JPTScrollPane
All Implemented Interfaces:
Accessible, ImageObserver, JPTConstants, MenuContainer, ScrollPaneConstants, Serializable, SwingConstants
Direct Known Subclasses:
ScrollableDisplay

public class JPTScrollPane
extends JScrollPane
implements JPTConstants

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

Since:
1.0
Version:
2.3.5
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JScrollPane
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
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.
 JPTFrame frame()
          Frame this panel in a JPTFrame and open the frame; return the frame constructed.
 JPTFrame frame(int location)
          Frame this panel in a JPTFrame and open the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; return the frame constructed.
 JPTFrame frame(String title)
          Frame this panel in a JPTFrame and open the frame; use the given title for the frame; return the frame constructed.
 JPTFrame frame(String title, Insets insets)
          Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given insets to inset the frame in the screen; return the frame constructed.
 JPTFrame frame(String title, int location)
          Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; return the frame constructed.
 JPTFrame frame(String title, int location, Insets insets)
          Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; use the given insets to inset the frame in the screen; return the frame constructed.
 GeneralDialog generalDialog(Object[][] actionData)
          Place this panel in a modal general dialog and open the dialog; use the action data to define the dialog buttons; return the dialog constructed.
 GeneralDialog generalDialog(Object[][] actionData, Object defaultAction)
          Place this panel in a modal general dialog and open the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.
 GeneralDialog generalDialog(String title, Object[][] actionData)
          Place this panel in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; return the dialog constructed.
 GeneralDialog generalDialog(String title, Object[][] actionData, Object defaultAction)
          Place this panel in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.
 GeneralDialog OKCancelDialog()
          Place this panel in a modal OK-Cancel dialog and open the dialog; return the dialog constructed.
 GeneralDialog OKCancelDialog(String title)
          Place this panel in a modal OK-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
 GeneralDialog OKDialog()
          Place this panel in a modal OK dialog and open the dialog; return the dialog constructed.
 GeneralDialog OKDialog(String title)
          Place this panel in a modal OK dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
 void refreshComponent()
          Refreshes the component by repacking the parent window.
 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.
 GeneralDialog YesNoCancelDialog()
          Place this panel in a modal Yes-No-Cancel dialog and open the dialog; return the dialog constructed.
 GeneralDialog YesNoCancelDialog(String title)
          Place this panel in a modal Yes-No-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.
 
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.

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

frame

public JPTFrame frame()

Frame this panel in a JPTFrame and open the frame; return the frame constructed.

Returns:
the frame constructed
Since:
2.3.5

frame

public JPTFrame frame(int location)

Frame this panel in a JPTFrame and open the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; return the frame constructed.

Parameters:
location - the constant representing the frame location
Returns:
the frame constructed
Since:
2.3.5

frame

public JPTFrame frame(String title)

Frame this panel in a JPTFrame and open the frame; use the given title for the frame; return the frame constructed.

Parameters:
title - the title for the frame
Returns:
the frame constructed
Since:
2.3.5

frame

public JPTFrame frame(String title,
                      int location)

Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; return the frame constructed.

Parameters:
title - the title for the frame
location - the constant representing the frame location
Returns:
the frame constructed
Since:
2.3.5

frame

public JPTFrame frame(String title,
                      Insets insets)

Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given insets to inset the frame in the screen; return the frame constructed.

Parameters:
title - the title for the frame
insets - the screen insets to use to adjust the location
Returns:
the frame constructed
Since:
2.3.5

frame

public JPTFrame frame(String title,
                      int location,
                      Insets insets)

Frame this panel in a JPTFrame and open the frame; use the given title for the frame; use the given location which should be either CENTER or one of the standard constants for one of the eight compass directions; use the given insets to inset the frame in the screen; return the frame constructed.

Parameters:
title - the title for the frame
location - the constant representing the frame location
insets - the screen insets to use to adjust the location
Returns:
the frame constructed
Since:
2.3.5

OKDialog

public GeneralDialog OKDialog()

Place this panel in a modal OK dialog and open the dialog; return the dialog constructed.

Returns:
the dialog constructed
Since:
2.3.5

OKDialog

public GeneralDialog OKDialog(String title)

Place this panel in a modal OK dialog and open the dialog; use the given title for the dialog; return the dialog constructed.

Parameters:
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.5

OKCancelDialog

public GeneralDialog OKCancelDialog()

Place this panel in a modal OK-Cancel dialog and open the dialog; return the dialog constructed.

Returns:
the dialog constructed
Since:
2.3.5

OKCancelDialog

public GeneralDialog OKCancelDialog(String title)

Place this panel in a modal OK-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.

Parameters:
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.5

YesNoCancelDialog

public GeneralDialog YesNoCancelDialog()

Place this panel in a modal Yes-No-Cancel dialog and open the dialog; return the dialog constructed.

Returns:
the dialog constructed
Since:
2.3.5

YesNoCancelDialog

public GeneralDialog YesNoCancelDialog(String title)

Place this panel in a modal Yes-No-Cancel dialog and open the dialog; use the given title for the dialog; return the dialog constructed.

Parameters:
title - the title for the dialog
Returns:
the dialog constructed
Since:
2.3.5

generalDialog

public GeneralDialog generalDialog(Object[][] actionData)

Place this panel in a modal general dialog and open the dialog; use the action data to define the dialog buttons; return the dialog constructed.

The parameter actionData is an Object[][] array that specifies each dialog Action in one of the following ways:

If the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

Parameters:
actionData - the action data
Returns:
the dialog constructed
Since:
2.3.5

generalDialog

public GeneralDialog generalDialog(Object[][] actionData,
                                   Object defaultAction)

Place this panel in a modal general dialog and open the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.

The parameter actionData is an Object[][] array that specifies each dialog Action in one of the following ways:

If the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

The Object supplied for the default action must either be an Action or a name that is supplied in the action data. If the parameter is null, no default action is set.

Parameters:
actionData - the action data
defaultAction - the default action
Returns:
the dialog constructed
Since:
2.3.5

generalDialog

public GeneralDialog generalDialog(String title,
                                   Object[][] actionData)

Place this panel in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; return the dialog constructed.

The parameter actionData is an Object[][] array that specifies each dialog Action in one of the following ways:

If the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

Parameters:
title - the title for the dialog
actionData - the action data
Returns:
the dialog constructed
Since:
2.3.5

generalDialog

public GeneralDialog generalDialog(String title,
                                   Object[][] actionData,
                                   Object defaultAction)

Place this panel in a modal general dialog and open the dialog; use the given title for the dialog; use the action data to define the dialog buttons; use the default action object to define the default button; return the dialog constructed.

The parameter actionData is an Object[][] array that specifies each dialog Action in one of the following ways:

If the option parameter is specified, it must be one of the following values that will determine what is done to the dialog when the action is finished:

If the option parameter is not specified, it is taken to be DialogAction.AUTO_CLOSE.

The Object supplied for the default action must either be an Action or a name that is supplied in the action data. If the parameter is null, no default action is set.

Parameters:
title - the title for the dialog
actionData - the action data
defaultAction - the default action
Returns:
the dialog constructed
Since:
2.3.5

refreshComponent

public void refreshComponent()
Refreshes the component by repacking the parent window.

Since:
2.3.5