|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.swingx.painter.AbstractPainter<T>
org.jdesktop.swingx.painter.AbstractLayoutPainter<T>
org.jdesktop.swingx.painter.AbstractAreaPainter<Object>
org.jdesktop.swingx.painter.ImagePainter
public class ImagePainter
A Painter instance that paints an image. Any Image is acceptable. This Painter also allows the developer to specify a "Style" -- CENTERED, TILED, SCALED, POSITIONED, and CSS_POSITIONED; with the following meanings:
Nested Class Summary | |
---|---|
static class |
ImagePainter.ScaleType
|
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter |
---|
AbstractAreaPainter.Style |
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter |
---|
AbstractLayoutPainter.HorizontalAlignment, AbstractLayoutPainter.VerticalAlignment |
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractPainter |
---|
AbstractPainter.Interpolation |
Constructor Summary | |
---|---|
ImagePainter()
Create a new ImagePainter. |
|
ImagePainter(BufferedImage image)
Create a new ImagePainter with the specified image and the Style Style.CENTERED |
|
ImagePainter(BufferedImage image,
AbstractLayoutPainter.HorizontalAlignment horizontal,
AbstractLayoutPainter.VerticalAlignment vertical)
Create a new ImagePainter with the specified image and alignment. |
|
ImagePainter(URL url)
|
|
ImagePainter(URL url,
AbstractLayoutPainter.HorizontalAlignment horizontal,
AbstractLayoutPainter.VerticalAlignment vertical)
|
Method Summary | |
---|---|
protected void |
doPaint(Graphics2D g,
Object component,
int width,
int height)
Subclasses must implement this method and perform custom painting operations here. |
BufferedImage |
getImage()
Gets the current image used for painting. |
double |
getImageScale()
Gets the current scaling factor used when drawing an image. |
String |
getImageString()
Used by the persistence mechanism. |
ImagePainter.ScaleType |
getScaleType()
|
boolean |
isHorizontalRepeat()
Indicates if the image will be repeated horizontally. |
boolean |
isScaleToFit()
|
boolean |
isVerticalRepeat()
Indicates if the image will be repeated vertically. |
protected Shape |
provideShape(Graphics2D g,
Object comp,
int width,
int height)
Returns the outline shape of this painter. |
void |
setHorizontalRepeat(boolean horizontalRepeat)
Sets if the image should be repeated horizontally. |
void |
setImage(BufferedImage image)
Sets the image to paint with. |
void |
setImageScale(double imageScale)
Sets the scaling factor used when drawing the image |
void |
setImageString(String imageString)
Used by the persistence mechanism. |
void |
setScaleToFit(boolean scaleToFit)
|
void |
setScaleType(ImagePainter.ScaleType scaleType)
|
void |
setVerticalRepeat(boolean verticalRepeat)
Sets if the image should be repeated vertically. |
Methods inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter |
---|
getAreaEffects, getBorderPaint, getBorderWidth, getFillPaint, getStyle, isPaintStretched, setAreaEffects, setBorderPaint, setBorderWidth, setFillPaint, setPaintStretched, setStyle |
Methods inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter |
---|
calculateLayout, getHorizontalAlignment, getInsets, getVerticalAlignment, isFillHorizontal, isFillVertical, setFillHorizontal, setFillVertical, setHorizontalAlignment, setInsets, setVerticalAlignment |
Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter |
---|
clearCache, configureGraphics, getFilters, getInterpolation, isAntialiasing, isCacheable, isDirty, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInterpolation, setVisible, shouldUseCache, validate |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImagePainter()
public ImagePainter(BufferedImage image)
image
- the image to be paintedpublic ImagePainter(BufferedImage image, AbstractLayoutPainter.HorizontalAlignment horizontal, AbstractLayoutPainter.VerticalAlignment vertical)
horizontal
- the horizontal alignmentvertical
- the vertical alignmentimage
- the image to be paintedpublic ImagePainter(URL url) throws IOException
IOException
public ImagePainter(URL url, AbstractLayoutPainter.HorizontalAlignment horizontal, AbstractLayoutPainter.VerticalAlignment vertical) throws IOException
IOException
Method Detail |
---|
public void setImage(BufferedImage image)
image
- if null, clears the image. Otherwise, this will set the
image to be painted.public BufferedImage getImage()
protected void doPaint(Graphics2D g, Object component, int width, int height)
doPaint
in class AbstractPainter<Object>
g
- The Graphics2D object in which to paintpublic void setScaleToFit(boolean scaleToFit)
public boolean isScaleToFit()
public void setImageScale(double imageScale)
imageScale
- the new image scaling factorpublic double getImageScale()
public String getImageString()
public void setImageString(String imageString)
public boolean isHorizontalRepeat()
public void setHorizontalRepeat(boolean horizontalRepeat)
horizontalRepeat
- the new horizontal repeat valuepublic boolean isVerticalRepeat()
public void setVerticalRepeat(boolean verticalRepeat)
verticalRepeat
- new value for the vertical repeatprotected Shape provideShape(Graphics2D g, Object comp, int width, int height)
AbstractAreaPainter
provideShape
in class AbstractAreaPainter<Object>
g
- graphicscomp
- The Object this painter will be painted on.width
- the width to paintheight
- the height to paint
public ImagePainter.ScaleType getScaleType()
public void setScaleType(ImagePainter.ScaleType scaleType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |