public abstract class ImageBackgroundPainterStrategy extends java.lang.Object implements BackgroundPainterStrategy
RTextAreaBase
as an image. The image is always stretched to completely fill the
RTextAreaBase
.
You can set the scaling hint used when stretching/skewing the image
to fit in the RTextAreaBase
's background via the
setScalingHint
method, but keep in mind the more
accurate the scaling hint, the less responsive your application will
be when stretching the window (as that's the only time the image's
size is recalculated).
BufferedImageBackgroundPainterStrategy
,
VolatileImageBackgroundPainterStrategy
限定符和类型 | 字段和说明 |
---|---|
protected java.awt.MediaTracker |
tracker |
构造器和说明 |
---|
ImageBackgroundPainterStrategy(com.fr.design.gui.syntax.ui.rtextarea.RTextAreaBase textArea)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
java.awt.Image |
getMasterImage()
Returns the "master" image; that is, the original, unscaled image.
|
com.fr.design.gui.syntax.ui.rtextarea.RTextAreaBase |
getRTextAreaBase()
Returns the text area using this strategy.
|
int |
getScalingHint()
Returns the scaling hint being used.
|
void |
paint(java.awt.Graphics g,
java.awt.Rectangle bounds)
Paints the image at the specified location and at the specified size.
|
protected abstract void |
paintImage(java.awt.Graphics g,
int x,
int y)
Paints the image at the specified location.
|
protected abstract void |
rescaleImage(int width,
int height,
int hint)
Rescales the displayed image to be the specified size.
|
void |
setImage(java.awt.Image image)
Sets the image this background painter displays.
|
void |
setImage(java.net.URL imageURL)
Sets the image this background painter displays.
|
void |
setScalingHint(int hint)
Sets the scaling hint to use when scaling the image.
|
public ImageBackgroundPainterStrategy(com.fr.design.gui.syntax.ui.rtextarea.RTextAreaBase textArea)
textArea
- The text area using this image as its background.public com.fr.design.gui.syntax.ui.rtextarea.RTextAreaBase getRTextAreaBase()
public java.awt.Image getMasterImage()
public int getScalingHint()
setScalingHint(int)
public final void paint(java.awt.Graphics g, java.awt.Rectangle bounds)
paint
在接口中 BackgroundPainterStrategy
g
- The graphics context.bounds
- The bounds in which to paint the image. The image
will be scaled to fit exactly in these bounds if necessary.protected abstract void paintImage(java.awt.Graphics g, int x, int y)
g
- The graphics context.x
- The x-coordinate at which to paint.y
- The y-coordinate at which to paint.protected abstract void rescaleImage(int width, int height, int hint)
width
- The new width of the image.height
- The new height of the image.hint
- The scaling hint to use.public void setImage(java.net.URL imageURL)
imageURL
- URL of a file containing the image to display.public void setImage(java.awt.Image image)
image
- The new image to use for the background.public void setScalingHint(int hint)
hint
- The hint to apply; e.g. Image.SCALE_DEFAULT
.getScalingHint()