|
|||||||||
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 | +--com.sun.jimi.core.component.JimiCanvas
An java.awt.Canvas
for easily displaying any image in a JIMI. supported
image format, or any java.awt.Image
. Subclasses will support using this as a Bean.
The following features exist :
java.net.URL
or a java.awt.Image
Field Summary | |
static int |
AREA
|
static int |
AREA_AVERAGING
|
protected boolean |
aspectAdjust
|
static int |
BEST_FIT
|
static int |
CENTER
|
static int |
CROP
|
static int |
CROP_AS_NECESSARY
|
static int |
EAST
|
static int |
FIT_TO_WIDTH
|
static int |
FIT_WIDTH
|
protected int |
fitWidth
|
protected ImageCache |
imageCache
|
protected int |
justificationPolicy
initialized policy to a default value. |
protected int |
loadingFlags
|
static int |
MULTIPAGE
|
protected java.awt.Image |
myImage
|
protected java.net.URL |
myImageLocation
|
protected java.awt.image.ImageProducer |
myImageProducer
|
static int |
NORTH
|
static int |
NORTHEAST
|
static int |
NORTHWEST
|
static int |
PAGED
|
protected ProgressListener |
progressListener
|
protected JimiImageRenderer |
renderer
|
static int |
REPLICATE
|
protected int |
resizePolicy
|
static int |
SCALE
|
protected int |
scalingPolicy
|
static int |
SCROLL
|
static int |
SOUTH
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
static int |
WEST
|
protected boolean |
willSizeToFit
This JimiCanvas will automatically resize to fit the
Image if true. |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
JimiCanvas()
No argument constructor for use in beanboxes. |
|
JimiCanvas(java.awt.Image myImage)
Creates a JimiCanvas displaying the image passed. |
|
JimiCanvas(int resizePolicy)
Creates a canvas with a specified initial resize policy. |
|
JimiCanvas(java.lang.String path)
Creates a JimiCanvas and loads the Image form the path specified. |
|
JimiCanvas(java.net.URL myImageLocation)
Creates a JimiCanvas and loads the Image from the URL specified. |
Method Summary | |
void |
firstImage()
For multi-image files, regress to the first image. |
int |
getFitWidth()
|
java.awt.Image |
getImage()
The image that this canvas is currently displaying. |
java.net.URL |
getImageLocation()
Where JIMI should look to find the image. |
int |
getJustificationPolicy()
|
JimiImageRenderer |
getRenderer()
|
protected JimiImageRenderer |
getRenderer(int resizePolicy)
Creates and returns a new renderer based on resize policy |
int |
getResizePolicy()
Do we crop the image, scale it, or scale it so that it fits best? |
int |
getScalingPolicy()
Retrieve the scaling mode currently in effect. |
boolean |
getWillSizeToFit()
If true, the canvas will resize itself so that it exactly fits the canvas. |
boolean |
hasNextImage()
For multi-image files, check if there is a next image to move to. |
boolean |
hasPreviousImage()
For multi-image files, check if there is a previous image to mvoe to. |
void |
lastImage()
For multi-image files, progress to the last image. |
protected java.awt.image.ImageProducer |
loadImageProducer(JimiReader reader)
Load an image. |
protected java.awt.image.ImageProducer |
loadImageProducer(java.lang.String filename)
|
protected java.awt.image.ImageProducer |
loadImageProducer(java.net.URL location)
|
void |
nextImage()
For multi-image files, progress to the next image. |
void |
previousImage()
For multi-image files, regress to the previous image. |
void |
setAspectAdjust(boolean flag)
Set whether the canvas should adjust aspect ratio for image formats which provide aspect information. |
void |
setFitWidth(int width)
Set the width to be used for FIT_WIDTH |
void |
setImage(java.awt.Image myImage)
We can explicitly set an Image instead of relying upon JIMI to load it. |
void |
setImageLocation(java.net.URL newLocation)
Where should JIMI look to find the image? This method loads the image from the URL then calls setImage. |
void |
setImagePath(java.lang.String path)
Loads an image from the path specified and calls setImage(Image) with the returned Image object. |
void |
setImageProducer(java.awt.image.ImageProducer producer)
displays an image created from the given ImageProducer |
void |
setJustificationPolicy(int newPolicy)
Which of the nine justification policies we use to place the image on the canvas |
void |
setLoadingFlags(int flags)
Set the flags to use for image loading. |
void |
setProgressListener(ProgressListener listener)
Set a ProgressListener to be informed of image loading status. |
void |
setRasterImage(JimiRasterImage raster)
display an image created from the given JimiRasterImage |
void |
setRenderer(JimiImageRenderer renderer)
set the renderer to be used |
void |
setResizePolicy(int newPolicy)
Do we crop the image, scale it, or scale it so that it fits best? |
void |
setScalingPolicy(int newPolicy)
Set the scaling mode for this canvas. |
void |
setWillSizeToFit(boolean newPolicy)
If true, the canvas will resize itself so that it exactly fits the the image. |
protected void |
showError(java.lang.String message)
|
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
addNotify,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
paramString,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
setLayout,
update,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int NORTH
public static final int SOUTH
public static final int EAST
public static final int WEST
public static final int NORTHEAST
public static final int NORTHWEST
public static final int SOUTHEAST
public static final int SOUTHWEST
public static final int CENTER
public static final int BEST_FIT
public static final int CROP
public static final int SCALE
public static final int SCROLL
public static final int FIT_WIDTH
public static final int AREA
public static final int MULTIPAGE
public static final int PAGED
public static final int CROP_AS_NECESSARY
public static final int FIT_TO_WIDTH
public static final int AREA_AVERAGING
public static final int REPLICATE
protected transient java.awt.Image myImage
protected transient java.awt.image.ImageProducer myImageProducer
protected transient java.net.URL myImageLocation
protected boolean willSizeToFit
JimiCanvas
will automatically resize to fit the
Image
if true.JimiCanvas#getWillResize
,
JimiCanvas#setWillResize
protected int fitWidth
protected JimiImageRenderer renderer
protected int justificationPolicy
protected int resizePolicy
protected int scalingPolicy
protected ProgressListener progressListener
protected int loadingFlags
protected boolean aspectAdjust
protected ImageCache imageCache
Constructor Detail |
public JimiCanvas()
public JimiCanvas(java.awt.Image myImage)
anImage
- The image to displaysetImage(java.awt.Image)
public JimiCanvas(java.net.URL myImageLocation)
aLocation
- Where to load the image using J.I.M.I. fromsetImageLocation(java.net.URL)
public JimiCanvas(java.lang.String path)
path
- to the imagesetImage(java.awt.Image)
public JimiCanvas(int resizePolicy)
resizePolicy
- the resize policyMethod Detail |
public void setRenderer(JimiImageRenderer renderer)
public JimiImageRenderer getRenderer()
protected JimiImageRenderer getRenderer(int resizePolicy)
setResizePolicy(int)
,
getResizePolicy()
public void setProgressListener(ProgressListener listener)
public void setLoadingFlags(int flags)
protected java.awt.image.ImageProducer loadImageProducer(JimiReader reader)
protected java.awt.image.ImageProducer loadImageProducer(java.net.URL location)
protected java.awt.image.ImageProducer loadImageProducer(java.lang.String filename)
protected void showError(java.lang.String message)
public void setFitWidth(int width)
public int getFitWidth()
public void setJustificationPolicy(int newPolicy)
newPolicy
- The new justification policyCENTER
,
NORTH
,
NORTHEAST
,
EAST
,
SOUTHEAST
,
SOUTH
,
SOUTHWEST
,
WEST
,
NORTHWEST
,
getJustificationPolicy()
public int getJustificationPolicy()
public void setResizePolicy(int newPolicy)
newPolicy
- One of policies which specify how to fit the image into the canvasCROP
,
SCALE
,
BEST_FIT
,
FIT_WIDTH
,
SCROLL
public int getResizePolicy()
CROP
,
SCALE
,
BEST_FIT
,
FIT_WIDTH
,
SCROLL
public void setScalingPolicy(int newPolicy)
newPolicy
- One of two policies which specify how to scale the
image into the canvasAREA_AVERAGING
,
REPLICATE
public int getScalingPolicy()
AREA_AVERAGING
,
REPLICATE
public void setWillSizeToFit(boolean newPolicy)
newPolicy
- If true, will resize the canvas to fit the new imagegetWillSizeToFit()
public boolean getWillSizeToFit()
setWillSizeToFit(boolean)
public void setImageLocation(java.net.URL newLocation)
newLocation
- Where JIMI should go to find the imagegetImageLocation()
,
getImage()
,
setImage(java.awt.Image)
public java.net.URL getImageLocation()
setImage
this value may be null
setImageLocation(java.net.URL)
public void setImage(java.awt.Image myImage)
myImage
- The java.awt.Image
that we wish to displaygetImage()
,
setImageLocation(java.net.URL)
,
getImageLocation()
public void setImagePath(java.lang.String path)
path
- The path to the imagesetImage(java.awt.Image)
public java.awt.Image getImage()
setImage(java.awt.Image)
,
setImageLocation(java.net.URL)
,
getImageLocation()
public void setImageProducer(java.awt.image.ImageProducer producer)
public void setRasterImage(JimiRasterImage raster)
raster
- the JimiRasterImage you want to displaypublic void nextImage()
public void previousImage()
public void firstImage()
public void lastImage()
public boolean hasNextImage()
public boolean hasPreviousImage()
public void setAspectAdjust(boolean flag)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |