All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.wizards.awt.ImagePanel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----com.sun.wizards.awt.InsetsPanel
|
+----com.sun.wizards.awt.ImagePanel
- public class ImagePanel
- extends InsetsPanel
The ImagePanel is a panel that displays an image. The image can be
aligned horizontally and vertically. The default alignment for
both directions is centered.
Here is the code for this applet:
import java.applet.Applet;
import java.awt.*;
import com.sun.wizards.awt.*;
public class Test extends Applet
{
public void init()
{
setLayout(new BorderLayout());
ImagePanel imagePanel = new ImagePanel();
Image image = getImage(getCodeBase(), "images/JAVA.85.GIF");
imagePanel.setImage(image);
add(imagePanel, "Center");
}
}
-
BOTTOM
- Bottom image alignment.
-
CENTER
- Center image alignment.
-
hAlign
- The horizontal alignment of the image.
-
image
- The current image that this panel will display.
-
LEFT
- Left image alignment.
-
loaded
- Keeps the status of the current image.
-
RIGHT
- Right image alignment.
-
TOP
- Top image alignment.
-
vAlign
- The vertical alignment of the image.
-
ImagePanel()
- Creates a new ImagePanel using the default layout manager.
-
ImagePanel(Insets)
- Creates a new ImagePanel with the specified Insets.
-
ImagePanel(int, int)
- Creates a new ImagePanel with the specified image
alignments.
-
ImagePanel(LayoutManager)
- Creates a new ImagePanel with the specified layout manager.
-
getMinimumSize()
- Gets the minimum size of this component.
-
getPreferredSize()
- Gets the preferred size of this component.
-
imageUpdate(Image, int, int, int, int, int)
- This version of imageUpdate paints the specified image only
after the entire image has been loaded.
-
paint(Graphics)
- Paints any components that are children of this container, and then paints
the current image, if one has been set.
-
setAlignment(int, int)
- sets the image alignment of this ImagePanel
-
setImage(Image)
- Set the image to be displayed by this ImagePanel.
LEFT
public static final int LEFT
- Left image alignment.
CENTER
public static final int CENTER
- Center image alignment.
RIGHT
public static final int RIGHT
- Right image alignment.
TOP
public static final int TOP
- Top image alignment.
BOTTOM
public static final int BOTTOM
- Bottom image alignment.
image
protected Image image
- The current image that this panel will display.
hAlign
protected int hAlign
- The horizontal alignment of the image.
vAlign
protected int vAlign
- The vertical alignment of the image.
loaded
protected boolean loaded
- Keeps the status of the current image. If true, the
image has been completely loaded. Otherwise, the image
has not been loaded.
ImagePanel
public ImagePanel()
- Creates a new ImagePanel using the default layout manager. The default layout manager
for all panels is the FlowLayout class.
ImagePanel
public ImagePanel(LayoutManager layout)
- Creates a new ImagePanel with the specified layout manager.
- Parameters:
- layout - The layout manager for this ImagePanel.
ImagePanel
public ImagePanel(Insets insets)
- Creates a new ImagePanel with the specified Insets.
- Parameters:
- insets - The insets for this ImagePanel.
ImagePanel
public ImagePanel(int hAlign,
int vAlign)
- Creates a new ImagePanel with the specified image
alignments.
- Parameters:
- hAlign - The desired horizontal alignment.
- vAlign - The desired vertical alignment.
setImage
public void setImage(Image image)
- Set the image to be displayed by this ImagePanel.
- Parameters:
- image - The new image to be displayed.
setAlignment
public void setAlignment(int hAlign,
int vAlign)
- sets the image alignment of this ImagePanel
- Parameters:
- hAlign - The desired horizontal alignment.
- vAlign - The desired vertical alignment.
getPreferredSize
public Dimension getPreferredSize()
- Gets the preferred size of this component.
- Returns:
- A dimension object indicating this component's preferred size.
- Overrides:
- getPreferredSize in class Container
getMinimumSize
public Dimension getMinimumSize()
- Gets the minimum size of this component.
- Returns:
- A dimension object indicating this component's minimum size.
- Overrides:
- getMinimumSize in class Container
paint
public void paint(Graphics g)
- Paints any components that are children of this container, and then paints
the current image, if one has been set.
- Parameters:
- g - The specifiecd Graphics window.
- Overrides:
- paint in class Container
imageUpdate
public synchronized boolean imageUpdate(Image image,
int infoFlags,
int x,
int y,
int width,
int height)
- This version of imageUpdate paints the specified image only
after the entire image has been loaded. This gives the
appearence of better performance at runtime.
- Parameters:
- image - The image being observed.
- infoFlags - See imageUpdate for more information.
- x - The x coordinate.
- y - The y coordinate.
- width - The width.
- height - The height.
- Returns:
- true if the flags indicate that the images is completely loaded; false otherwise.
- Overrides:
- imageUpdate in class Component
All Packages Class Hierarchy This Package Previous Next Index