|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.sun.media.jai.widget.DisplayJAI
A JavaTM Foundation Classes JPanel
which is able
to contain an image. The image and its container may have different
sizes. The image may also be positioned within the container.
This class extends JPanel
in order to support layout
management. Image tiling is supported as of version 1.3 of the
JavaTM 2 Platform via
Graphics2D.drawRenderedImage(RenderedImage,AffineTransform)
.
This class is not a committed part of the JavaTM Advanced Imaging API per se. It might therefore not be supported by JAI implementations other than that of Sun Microsystems, Inc.
Graphics2D
,
RenderedImage
,
JPanel
,
JComponent
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected int |
originX
Abscissa of image origin relative to panel origin. |
protected int |
originY
Ordinate of image origin relative to panel origin. |
protected RenderedImage |
source
The image to display. |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DisplayJAI()
Constructs a DisplayJAI and sets its
the layout to null . |
|
DisplayJAI(RenderedImage image)
Constructs a DisplayJAI , sets its layout to
null , and sets its displayed image. |
Method Summary | |
Point |
getOrigin()
Retrieves the image origin. |
RenderedImage |
getSource()
Returns the image to be displayed by this panel. |
void |
mouseClicked(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse clicks. |
void |
mouseDragged(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse dragging. |
void |
mouseEntered(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse entrances. |
void |
mouseExited(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse exits. |
void |
mouseMoved(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse movement. |
void |
mousePressed(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse presses. |
void |
mouseReleased(MouseEvent e)
An empty method which should be overridden by subclasses which respond to mouse releases. |
void |
paintComponent(Graphics g)
Draws the image or fills the panel with a background color. |
void |
set(RenderedImage im)
Sets a new image to display. |
void |
set(RenderedImage im,
int x,
int y)
Sets a new image to display and its coordinates within the container. |
void |
setOrigin(int x,
int y)
Moves the image within it's container. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected RenderedImage source
protected int originX
protected int originY
Constructor Detail |
public DisplayJAI()
DisplayJAI
and sets its
the layout to null
.
public DisplayJAI(RenderedImage image)
DisplayJAI
, sets its layout to
null
, and sets its displayed image.
The preferred size is set such that its width is the image width plus the left and right insets and its height is the image height plus the top and bottom insets.
image
- The image to display.
IllegalArgumentException
- if image
is
null
.Method Detail |
public void setOrigin(int x, int y)
originX
and originY
are set to the
parameter valus x
and y
, respectively.
Component.repaint()
is invoked after the origin values are changed.
x
- image origin abscissa.y
- image origin ordinate.public Point getOrigin()
public void set(RenderedImage im)
The preferred size is set such that its width is the image
width plus the left and right insets and its height is the image
height plus the top and bottom insets. JComponent.revalidate()
and
Component.repaint()
are invoked after all other changes.
im
- The image to display.
IllegalArgumentException
- if im
is
null
.public void set(RenderedImage im, int x, int y)
The preferred size is set such that its width is the image
width plus the left and right insets and its height is the image
height plus the top and bottom insets. JComponent.revalidate()
and
Component.repaint()
are invoked after all other changes.
im
- The image to display.x
- image origin abscissa.y
- image origin ordinate.
IllegalArgumentException
- if im
is
null
.public RenderedImage getSource()
source
instance variable.public void paintComponent(Graphics g)
If the current image is null
, the rectangle
new Rectangle(0,0,
is filled with the background color returned by
JComponent.getWidth()
,JComponent.getHeight()
)Component.getBackground()
.
If the current image is non-null
, the rectangle
returned by Graphics.getClipBounds()
is filled with the
background color and the image is drawn using
Graphics2D.drawRenderedImage(RenderedImage,AffineTransform)
at the location
(
.
JComponent.getInsets()
.left+originX,
JComponent.getInsets()
.right+originY)
g
- Graphics
context in which to paint.public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |