| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--ncsa.horizon.viewer.ImageCanvas
The placement and sizing of the image is controlled by the display mode, set using setMode(). These modes (defined in the ImageCanvas.Modes interface) are:
The painting of the images is done using a double-buffering technique. Thus, this canvas is helpful when one wants to overlay graphics that require freqent updates (e.g. a cursor). The buffer will only be updated with a call to displayImages() or when the canvas is resized.
| Inner Class Summary | |
| static | ImageCanvas.Modes
|
| Field Summary | |
| int | mode
Indicates the mode in which the Images are painted |
| java.awt.Font | msgfont
The font used for the message |
| java.awt.Image | offscreen
Points to the off-screen Image used for double buffering |
| java.awt.Dimension | prefSize
The variable preferred size of the Canvas |
| boolean | redrawImages
Boolean to indicate if the offImage needs to be repainted |
| static int | SIZE_IMAGE_CENTER
Deprecated. Trim the image to the Canvas size (centered) |
| static int | SIZE_IMAGE_FIT
Deprecated. Fit the image to the Canvas size (default) |
| static int | SIZE_IMAGE_FLUSH
Deprecated. Scale the image to the Canvas size (flush top/left) |
| static int | SIZE_IMAGE_SCALE
Deprecated. Scale the image to the Canvas size (centered) |
| static int | SIZE_IMAGE_TRUNCATE
Deprecated. Trim the image to the Canvas size (flush top/left) |
| java.util.Vector | views
The Vector containing all the Images which were added to the Canvas |
| Fields inherited from class java.awt.Component | |
| BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | |
| Constructor Summary | |
| ImageCanvas(int w,
int h)
|
|
| ImageCanvas(java.awt.Dimension sz)
|
|
| Method Summary | |
| void | addImage(java.awt.Image im)
Add an image to the current set of Images displayed by the Canvas. |
| void | clear()
Clear the canvas. |
| void | displayImages()
Display the current Images. |
| int | getMode()
return the mode being used by this canvas |
| java.awt.Dimension | getPreferredSize()
Gets the preferred size of the Canvas which is the same as the size it was created with. |
| java.awt.Rectangle | getViewBounds(int width,
int height)
Return a rectangle specifying the bounds within the display component that an image of a given size would be painted. |
| boolean | offPaint()
Paint the off screen image. |
| void | paint(java.awt.Graphics g)
|
| boolean | paintImage(java.awt.Graphics g,
java.awt.Image im)
|
| void | paintMessage(java.awt.Graphics g,
java.lang.String msg)
print a message on using the Graphics object. |
| void | setBounds(int x,
int y,
int width,
int height)
|
| void | setMode(int mode)
Set the display mode for sizing and placing the image in the canvas. |
| void | setPreferredSize(java.awt.Dimension prefSize)
Allows the parent Container to set the preferred size of the Canvas according to its preference. |
| void | setPreferredSize(int w,
int h)
Allows the parent Container to set the preferred size of the Canvas according to its preference. |
| void | update(java.awt.Graphics g)
|
| java.awt.Dimension | viewSize(int wd,
int ht)
determine the dimesions necessary to fit an image of width wd and height ht into the display canvas (while preserving the aspect ratio). |
| Methods inherited from class java.awt.Canvas | |
| addNotify, paint | |
| Methods inherited from class java.awt.Component | |
| action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate | |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
public static final int SIZE_IMAGE_FIT
public static final int SIZE_IMAGE_CENTER
public static final int SIZE_IMAGE_TRUNCATE
public static final int SIZE_IMAGE_SCALE
public static final int SIZE_IMAGE_FLUSH
protected java.util.Vector views
protected int mode
protected java.awt.Image offscreen
protected java.awt.Font msgfont
protected java.awt.Dimension prefSize
protected boolean redrawImages
| Constructor Detail |
public ImageCanvas(int w,
int h)
public ImageCanvas(java.awt.Dimension sz)
| Method Detail |
public java.awt.Dimension getPreferredSize()
public void setPreferredSize(java.awt.Dimension prefSize)
public void setPreferredSize(int w,
int h)
public void addImage(java.awt.Image im)
public void displayImages()
public void clear()
public void update(java.awt.Graphics g)
public void paint(java.awt.Graphics g)
protected boolean offPaint()
protected boolean paintImage(java.awt.Graphics g,
java.awt.Image im)
protected void paintMessage(java.awt.Graphics g,
java.lang.String msg)
public java.awt.Rectangle getViewBounds(int width,
int height)
public java.awt.Dimension viewSize(int wd,
int ht)
public int getMode()
public void setMode(int mode)
mode
- one of the display modes defined by this class
public void setBounds(int x,
int y,
int width,
int height)
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||