OME
Class ImageTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--OME.ImageTable

public class ImageTable
extends javax.swing.JComponent

This class serves to cache images and it also provides simple manipulations of those images such as scalings and rotations.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
Constructor Summary
ImageTable()
          Constructs the image table.
 
Method Summary
 java.awt.Image drawDashedHLine(java.awt.Image im)
          Draws a dashed horizontal line through through an image, and returns the result.
 java.awt.Image drawHLine(java.awt.Image im)
          Draws a horizontal line through through an image, and returns the result.
 int getHeight(java.awt.Image i)
          Gets the height of an image.
 java.awt.Image getImage(java.lang.Object handle)
          Returns the image with the handle.
 java.awt.Image getRotation(java.awt.Image image, float rotation)
          Return the image with specified image and rotation (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
 java.awt.Image getScaling(java.awt.Image image, double scale)
          Return the specified image and size (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
 java.awt.Image getScaling(java.awt.Image image, double widthfactor, double heightfactor)
          Return the specified image and size (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
 java.awt.Image getSizing(java.awt.Image im, int width, int height)
          Returns a rescaled version of the specified image to the specified height or width.
 int getWidth(java.awt.Image i)
          Gets the width of an image.
 java.awt.Image putImage(java.lang.String filename, java.lang.Object handle)
          Stores the image into the cache with the passed handle.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI
 
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, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, 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, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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
 

Constructor Detail

ImageTable

public ImageTable()
Constructs the image table.
Method Detail

getScaling

public java.awt.Image getScaling(java.awt.Image image,
                                 double scale)
Return the specified image and size (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
Parameters:
image - the image required
scale - the scale factor needed for the image

getScaling

public java.awt.Image getScaling(java.awt.Image image,
                                 double widthfactor,
                                 double heightfactor)
Return the specified image and size (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
Parameters:
image - the image required
widthfactor - width multiple desired
heightfactor - height multiple desired

getSizing

public java.awt.Image getSizing(java.awt.Image im,
                                int width,
                                int height)
Returns a rescaled version of the specified image to the specified height or width. If the provided height is 0, the image will be sized to the specified width, and the image will retain its original height/width ratio. Providing a width of 0 work similarly. If both width and height are 0, the original image is returned.
Parameters:
im - the image which should be rescaled
width - the width of the rescaled image
height - the height of the rescaled image

getRotation

public java.awt.Image getRotation(java.awt.Image image,
                                  float rotation)
Return the image with specified image and rotation (loading it from the scaleTable, if it exists in scaleTable, otherwise creating it and adding it to the scaleTable).
Parameters:
image - the image to be scaled
rotation - the rotation needed for the image

getImage

public java.awt.Image getImage(java.lang.Object handle)
Returns the image with the handle.

putImage

public java.awt.Image putImage(java.lang.String filename,
                               java.lang.Object handle)
Stores the image into the cache with the passed handle. The String filename, *can* safely be used for this, but you will take a performance hit, so if you have some other handle lying around, then use it instead. This method will *immediately* load the image, ie: wait to be done before returning.
Parameters:
filename - a possible handle for the image
handle - an alternative handle to be used, if one chooses not to use the filanem as the handle.

getWidth

public int getWidth(java.awt.Image i)
Gets the width of an image.
Parameters:
image - the image whose width we want

getHeight

public int getHeight(java.awt.Image i)
Gets the height of an image.
Parameters:
image - the image whose height we want

drawHLine

public java.awt.Image drawHLine(java.awt.Image im)
Draws a horizontal line through through an image, and returns the result. Useful for images that represent links.
Parameters:
im - the image which the horizontal line should be drawn through

drawDashedHLine

public java.awt.Image drawDashedHLine(java.awt.Image im)
Draws a dashed horizontal line through through an image, and returns the result. Useful for images that represent links.
Parameters:
im - the image which the dashed horizontal line should be drawn through.