|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.programix.gui.image.Picture
public class Picture
A Swing component that can be used to simple show an image (picture) on a
component. Instances are Serializable as only the bytes
needed to re-created the image are transmitted. The internal
BufferedImage is declared to be (transient)
and is left behind. If the image was originally created from a
a byte[], these bytes are retained for transmission.
If an image was used to create the Picture, then a
byte[] is created only on-demand (in the lossless, compressed
PNG format).
If you don't need a JComponent but just need a
BufferedImage, then you can use ImageTools.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 | |
|---|---|
Picture()
Creates a Picture with no initial image. |
|
Picture(BufferedImage bufferedImage)
The BufferedImage to be drawn on this JComponent. |
|
Picture(byte[] imageBytes)
Creates a Picture by storing the specified bytes until there is a demand for the BufferedImage. |
|
Picture(File source)
Reads all the bytes from source and passes them to the constructor that takes a byte[]. |
|
Picture(Image image)
Creates a BufferedImage from the Image specified
and calls the constructor that takes a BufferedImage
parameter. |
|
Picture(InputStream source)
Reads all the bytes from source and passes them to the constructor that takes a byte[]. |
|
Picture(String resourceName)
Reads all the bytes from the resource specified by resourceName and passes them to the constructor that takes a byte[]. |
|
Picture(URL source)
Reads all the bytes from source and passes them to the constructor that takes a byte[]. |
|
| Method Summary | |
|---|---|
void |
clearImage()
Clears out any current image (blanks out the picture). |
BufferedImage |
getImage()
|
byte[] |
getImageBytes()
|
int |
getImageHeight()
|
int |
getImageWidth()
|
Dimension |
getPreferredSize()
|
protected void |
paintComponent(Graphics g)
|
void |
setImage(BufferedImage bufferedImage)
|
void |
setImage(Image image)
Creates a BufferedImage from the Image specified
and calls the setImage method that takes a
BufferedImage parameter. |
void |
setImageBytes(byte[] imageBytes)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Picture(BufferedImage bufferedImage)
BufferedImage to be drawn on this JComponent.
The byte[] representation of the image is not created
during construction@mdash;only on demand.
bufferedImage - the image to draw on this component.public Picture(Image image)
BufferedImage from the Image specified
and calls the constructor that takes a BufferedImage
parameter. If the Image reference passed in is actually
pointing to a BufferedImage, then this constructor is very
efficient and simply does an explicit cast and calls the
other constructor.
image - the Image to convert to a BufferedImage.public Picture(byte[] imageBytes)
BufferedImage. Typically,
the BufferedImage is created the first time that
JComponent.paint(Graphics) is called. For help is getting
a byte[] to use to create a
imageBytes - the formatted bytes that can be decoded into
an image.
public Picture(InputStream source)
throws IOException
IOException
public Picture(File source)
throws IOException
IOException
public Picture(URL source)
throws IOException
IOException
public Picture(String resourceName)
throws IOException
IOExceptionpublic Picture()
| Method Detail |
|---|
public void clearImage()
public BufferedImage getImage()
public void setImage(BufferedImage bufferedImage)
public void setImage(Image image)
BufferedImage from the Image specified
and calls the setImage method that takes a
BufferedImage parameter.
If the Image reference passed in is actually
pointing to a BufferedImage, then this method is very
efficient and simply does an explicit cast and calls the
other method.
image - the Image to convert to a BufferedImage.
public byte[] getImageBytes()
throws ImageTools.ImageException
ImageTools.ImageExceptionpublic void setImageBytes(byte[] imageBytes)
public int getImageWidth()
public int getImageHeight()
public Dimension getPreferredSize()
getPreferredSize in class JComponentprotected void paintComponent(Graphics g)
paintComponent in class JComponent
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||