|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
uk.ac.essex.common.gui.panel.ImagePane
public class ImagePane
This class defines a pane to display a RenderedImage
. A
three-dimensional border is created to form the frame for the displayed
image. When this pane/image is focused, the three-dimensional border is
shown as the image is pressed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.border.Border |
compound
Two compound border to imitate a three-dimensional effect when this pane or image gains/losses focus. |
protected javax.swing.border.Border |
compound1
|
protected boolean |
displayCenter
Indicates to display a red cross at the center of the pane or not. |
protected java.lang.String |
imageName
The image name may be displayed as the title of this pane when the border is a titled border. |
protected boolean |
isFocused
Indicates this pane is focused or not. |
protected java.awt.Point |
origin
The origin of the pane in the image coordinate system. |
protected int |
referenceX
The reference point coordinates in the image coodinate system. |
protected int |
referenceY
|
protected ResizePolicy |
resizePolicy
The resizing policy for this pane. |
protected int |
shiftX
The translation between the display coordinate system and the image coordinate system. |
protected int |
shiftY
|
protected java.awt.image.RenderedImage |
source
The image to be displayed |
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 | |
---|---|
ImagePane(java.awt.image.RenderedImage image,
ResizePolicy policy,
java.lang.String imageName)
Constructor accepts a uk.ac.essex.common.gui.pane.ResizePolicy . |
|
ImagePane(java.awt.image.RenderedImage image,
java.lang.String imageName)
Constructor. |
|
ImagePane(java.lang.String imageName)
The default constructor. |
Method Summary | |
---|---|
java.awt.image.RenderedImage |
getImage()
Return the displayed image. |
java.awt.Point |
getReference()
Return the position of the reference point. |
boolean |
isFocused()
Return the focus status. |
void |
paintComponent(java.awt.Graphics g)
The paint procedure: paint the border based on the focus status, draw the image, and draw the red cross if the flag is set. |
void |
set(java.awt.image.RenderedImage im)
Replace the displayed image. |
void |
set(java.awt.image.RenderedImage im,
java.lang.String imageName)
Replace the displayed image and the name of this image. |
void |
set(java.awt.image.RenderedImage im,
java.lang.String imageName,
int x,
int y)
Display a new image at the new reference position. |
void |
setDisplayCenter(boolean b)
Enable/disable to display the red cross at the center of this pane. |
void |
setFocused(boolean b)
Set the focus flag and process the related events. |
void |
setReference(int x,
int y)
Change the position of the reference point. |
void |
setResizePolicy(ResizePolicy policy)
Set a new resizing policy to this uk.ac.essex.common.gui.pane.ImagePane . |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, isValidateRoot, paint, paintBorder, paintChildren, 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, setLayout, 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, 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, setComponentOrientation, 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 |
Field Detail |
---|
protected java.awt.image.RenderedImage source
protected java.lang.String imageName
protected int referenceX
ResizePolicy
protected int referenceY
protected int shiftX
protected int shiftY
protected java.awt.Point origin
protected javax.swing.border.Border compound
protected javax.swing.border.Border compound1
protected boolean isFocused
protected boolean displayCenter
protected ResizePolicy resizePolicy
ResizePolicy
Constructor Detail |
---|
public ImagePane(java.lang.String imageName)
imageName
- The RenderedImage to be displayed in this pane.public ImagePane(java.awt.image.RenderedImage image, java.lang.String imageName)
uk.ac.essex.common.gui.pane.ResizePolicy
, the image size and the pane
size.
image
- The RenderedImage to be displayed in this pane.imageName
- The name of the provided image.public ImagePane(java.awt.image.RenderedImage image, ResizePolicy policy, java.lang.String imageName)
uk.ac.essex.common.gui.pane.ResizePolicy
.
image
- The RenderedImage
for display in this pane.policy
- The policy to move the image when this pane is resized.imageName
- The name of the provided image.Method Detail |
---|
public void setResizePolicy(ResizePolicy policy)
uk.ac.essex.common.gui.pane.ImagePane
.
policy
- The new resizing policy for the display.public void setReference(int x, int y)
x
- The x coordinate of the new reference in the image coordinate
system.y
- The y coordinate of the new reference in the image coordinate
system.public java.awt.Point getReference()
public void set(java.awt.image.RenderedImage im)
im
- The new image for display.public void set(java.awt.image.RenderedImage im, java.lang.String imageName)
im
- The new image for display.imageName
- The image name.public void set(java.awt.image.RenderedImage im, java.lang.String imageName, int x, int y)
public java.awt.image.RenderedImage getImage()
public void setFocused(boolean b)
uk.ac.essex.common.gui.pane.Focusable
.
setFocused
in interface Focusable
Focusable
public boolean isFocused()
uk.ac.essex.common.gui.pane.Focusable
.
isFocused
in interface Focusable
Focusable
public void setDisplayCenter(boolean b)
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |