FileDocCategorySizeDatePackage
ImagePanel.javaAPI DocGlassfish v2 API5248Fri May 04 22:35:06 BST 2007com.sun.enterprise.tools.upgrade.gui

ImagePanel

public class ImagePanel extends InsetsPanel

Fields Summary
public static final int
LEFT
public static final int
CENTER
public static final int
RIGHT
public static final int
TOP
public static final int
BOTTOM
protected Image
image
protected int
hAlign
protected int
vAlign
protected boolean
loaded
Constructors Summary
public ImagePanel()


     
    
        image = null;
        hAlign = 2;
        vAlign = 2;
        loaded = false;
    
public ImagePanel(int i, int j)

        image = null;
        hAlign = 2;
        vAlign = 2;
        loaded = false;
        hAlign = i;
        vAlign = j;
    
public ImagePanel(Insets insets)

        //super(insets);
        image = null;
        hAlign = 2;
        vAlign = 2;
        loaded = false;
    
public ImagePanel(LayoutManager layoutmanager)

        super(layoutmanager);
        image = null;
        hAlign = 2;
        vAlign = 2;
        loaded = false;
    
Methods Summary
public java.awt.DimensiongetMinimumSize()

        return getPreferredSize();
    
public java.awt.DimensiongetPreferredSize()

        Dimension dimension = new Dimension(0, 0);
        if(image != null)
        {
            dimension.width = image.getWidth(this);
            dimension.height = image.getHeight(this);
        }
        return dimension;
    
public synchronized booleanimageUpdate(java.awt.Image image1, int i, int j, int k, int l, int i1)

        if((i & 0x20) != 0)
        {
            loaded = true;
            repaint();
            return false;
        } else
        {
            return true;
        }
    
public voidpaint(java.awt.Graphics g)

        super.paint(g);
        if(loaded)
        {
            int i = 0;
            int j = 0;
            int k = image.getWidth(this);
            int l = image.getHeight(this);
            Dimension dimension = getSize();
            g.setClip(0, 0, dimension.width, dimension.height);
            switch(hAlign)
            {
            case 1: // '\001'
                i = super.insets.left;
                break;

            case 2: // '\002'
                i = (dimension.width - (super.insets.left + super.insets.right) - k) / 2 + super.insets.left;
                break;

            case 3: // '\003'
                i = dimension.width - k - super.insets.right;
                break;
            }
            switch(vAlign)
            {
            case 1: // '\001'
                j = super.insets.top;
                break;

            case 2: // '\002'
                j = (dimension.height - (super.insets.top + super.insets.bottom) - l) / 2 + super.insets.top;
                break;

            case 3: // '\003'
                j = dimension.height - l - super.insets.bottom;
                break;
            }
            g.drawImage(image, i, j, this);
        }
    
public voidsetAlignment(int i, int j)

        hAlign = i;
        vAlign = j;
    
public voidsetImage(java.awt.Image image1)

        loaded = false;
        image = image1;
        prepareImage(image1, this);