|
Generic Environment GUI Class Library | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPanel
|
+--ScrollableEnvDisplay
Environment-Based Applications:
A ScrollableEnvDisplay is a panel containing a
scrollable graphical display of an environment.
| Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
protected java.awt.Color |
bgColor
|
protected int |
cellSize
|
protected static int |
DEFAULT_MIN_CELL_SIZE
|
protected static int |
DEFAULT_VIEWABLE_SIZE
|
protected int |
displayHeight
|
protected int |
displayWidth
|
protected static int |
LOCATION_TOOL_TIPS
|
protected int |
minCellSize
|
protected int |
numCols
|
protected int |
numRows
|
protected static int |
OBJECT_STRING_TOOL_TIPS
|
protected static java.awt.Color |
OCEAN_BLUE
|
protected int |
originCol
|
protected int |
originRow
|
protected Environment |
theEnv
|
protected boolean |
toolTipsEnabledFlag
|
protected int |
toolTipsType
|
protected boolean |
visibleGridLines
|
| 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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
ScrollableEnvDisplay()
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(java.awt.Color backgroundColor)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int minimumCellSize)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int minimumCellSize,
java.awt.Color backgroundColor)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int width,
int height)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int width,
int height,
java.awt.Color backgroundColor)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int width,
int height,
int minimumCellSize)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
ScrollableEnvDisplay(int viewingWidth,
int viewingHeight,
int minimumCellSize,
java.awt.Color backgroundColor)
Constructs a new ScrollableEnvDisplay object with no environment and an empty view. |
|
| Method Summary | |
java.awt.Color |
backgroundColor()
Gets the background color for displaying the environment. |
protected int |
colToXCoord(int col)
|
protected void |
drawGridlines(java.awt.Graphics2D g2)
Draws the gridlines for the environment. |
protected void |
drawLocatable(java.awt.Graphics2D g2,
Locatable obj)
Draws one environment object. |
Environment |
environment()
Gets the environment. |
protected int |
extraHeight()
|
protected int |
extraWidth()
|
protected javax.swing.JViewport |
getEnclosingViewport()
|
java.awt.Dimension |
getMinimumSize()
Returns the minimum size of the display, for use by layout manager. |
java.lang.String |
getPannableTipText()
|
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
java.awt.Dimension |
getPreferredSize()
Returns the desired size of the display, for use by layout manager. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
|
java.lang.String |
getToolTipText(java.awt.event.MouseEvent evt)
Given a MouseEvent, determines what text to place in the floating tool tip when the the mouse hovers over this location. |
boolean |
gridLinesAreVisible()
Returns true if the grid lines are visible,
false otherwise. |
boolean |
isPannableUnbounded()
|
Location |
locationForPoint(java.awt.Point p)
Given a Point, determines which environment location (if any) is under the mouse. |
void |
makeGridLinesVisible(boolean visible)
Makes the gridlines visible or invisible, depending on the value of the visible parameter. |
void |
makeToolTipsReportLocation()
Sets tool tips to provide information about the locations of cells in the environment. |
void |
makeToolTipsReportObject()
Sets tool tips to provide information about the contents of cells in the environment. |
int |
minimumCellSize()
Gets the minimum cell size. |
void |
paint(java.awt.Graphics g)
Shows the environment. |
void |
paintComponent(java.awt.Graphics g)
Paints this component. |
void |
panBy(int hDelta,
int vDelta)
|
protected void |
recalculateCellSize(javax.swing.JViewport vp,
int minSize)
Calculates the cell size to use given the current viewable region and the the number of rows and columns in the environment. |
void |
recenterOnOrigin()
Pans the display back to the origin, so that 0, 0 is at the the upper left of the visible viewport. |
protected int |
rowToYCoord(int row)
|
void |
setBackgroundColor(java.awt.Color newBackgroundColor)
Sets the background color for displaying the environment. |
void |
setEnv(Environment env)
Sets the Environment being displayed. |
void |
setToolTipsEnabled(boolean flag)
Enables/disables showing of tooltip giving information about the environment object beneath the mouse. |
void |
showEnv()
Shows the environment. |
boolean |
toolTipsEnabled()
Indicates whether tool tips have been enabled. |
protected int |
xCoordToCol(int xCoord)
|
protected int |
yCoordToRow(int yCoord)
|
void |
zoomIn()
Zooms in the display by doubling the current cell size. |
void |
zoomOut()
Zooms out the display by halving the current cell size. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUIClassID, paramString, 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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final int DEFAULT_MIN_CELL_SIZE
protected static final int DEFAULT_VIEWABLE_SIZE
protected static final java.awt.Color OCEAN_BLUE
protected static final int LOCATION_TOOL_TIPS
protected static final int OBJECT_STRING_TOOL_TIPS
protected Environment theEnv
protected int displayWidth
protected int displayHeight
protected int minCellSize
protected int numRows
protected int numCols
protected int originRow
protected int originCol
protected int cellSize
protected java.awt.Color bgColor
protected boolean visibleGridLines
protected boolean toolTipsEnabledFlag
protected int toolTipsType
| Constructor Detail |
public ScrollableEnvDisplay()
public ScrollableEnvDisplay(int width,
int height)
width - the width of the viewing areaheight - the height of the viewing areapublic ScrollableEnvDisplay(int minimumCellSize)
minimumCellSize - minimum cell side length
public ScrollableEnvDisplay(int width,
int height,
int minimumCellSize)
width - the width of the viewing areaheight - the height of the viewing areaminimumCellSize - minimum cell side lengthpublic ScrollableEnvDisplay(java.awt.Color backgroundColor)
backgroundColor - color to paint background of environment
public ScrollableEnvDisplay(int width,
int height,
java.awt.Color backgroundColor)
width - the width of the viewing areaheight - the height of the viewing areabackgroundColor - color to paint background of environment
public ScrollableEnvDisplay(int minimumCellSize,
java.awt.Color backgroundColor)
minimumCellSize - minimum cell side lengthbackgroundColor - color to paint background of environment
public ScrollableEnvDisplay(int viewingWidth,
int viewingHeight,
int minimumCellSize,
java.awt.Color backgroundColor)
viewingWidth - the width of the viewing areaviewingHeight - the height of the viewing areaminimumCellSize - minimum cell side lengthbackgroundColor - color to paint background of environment| Method Detail |
public void setEnv(Environment env)
setEnv in interface SettableEnvDisplayenv - the Environment to displayprotected javax.swing.JViewport getEnclosingViewport()
protected void recalculateCellSize(javax.swing.JViewport vp,
int minSize)
vp - the view port that represents the viewable regionminSize - the minimum size for the side of a cellpublic Environment environment()
public int minimumCellSize()
public java.awt.Color backgroundColor()
public void setBackgroundColor(java.awt.Color newBackgroundColor)
public void makeGridLinesVisible(boolean visible)
visible parameter. The gridlines are visible
by default.visible - whether to make the gridlines visible (true)
or invisible (false)public boolean gridLinesAreVisible()
true if the grid lines are visible,
false otherwise.public void showEnv()
repaint method is the standard way to ask a
Swing component to redraw itself. This eventually turns into a call
back to our version of the the standard paintComponent
method where we do the actual drawing.showEnv in interface SettableEnvDisplaypublic void paint(java.awt.Graphics g)
repaint method is the standard way to ask a
Swing component to redraw itself. This eventually turns into a call
back to our version of the the standard paintComponent
method where we do the actual drawing.paint in class javax.swing.JComponentpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the Graphics object to use to render this componentprotected void drawGridlines(java.awt.Graphics2D g2)
g2 - the Graphics2 object to use to render
protected void drawLocatable(java.awt.Graphics2D g2,
Locatable obj)
g2 - the Graphics2D object to use to renderobj - the Locatable object to draw
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableUnitIncrement in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableBlockIncrement in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface javax.swing.Scrollablepublic java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.Scrollablepublic void zoomIn()
public void zoomOut()
public void recenterOnOrigin()
public void panBy(int hDelta,
int vDelta)
panBy in interface PseudoInfiniteViewport.Pannablepublic boolean isPannableUnbounded()
isPannableUnbounded in interface PseudoInfiniteViewport.Pannablepublic java.lang.String getPannableTipText()
getPannableTipText in interface PseudoInfiniteViewport.Pannablepublic void setToolTipsEnabled(boolean flag)
flag - whether to enable/disable tool tipspublic boolean toolTipsEnabled()
true if tool tips are enabled;
false otherwisepublic void makeToolTipsReportLocation()
public void makeToolTipsReportObject()
public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
getToolTipText in class javax.swing.JComponentevt - the MouseEvent in questionpublic Location locationForPoint(java.awt.Point p)
p - the Point in question (in display's coordinate system)protected int xCoordToCol(int xCoord)
protected int yCoordToRow(int yCoord)
protected int colToXCoord(int col)
protected int rowToYCoord(int row)
public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic java.awt.Dimension getMinimumSize()
getMinimumSize in class javax.swing.JComponentprotected int extraWidth()
protected int extraHeight()
|
Generic Environment GUI Class Library | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||