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

Header

public class Header extends Canvas

Fields Summary
private String
headerText
Constructors Summary
public Header()

        this("");
    
public Header(String s)

        headerText = null;
        headerText = s;
        setForeground(Color.black);
        try
        {
            setFont(new Font("SansSerif", 0, 12));
        }
        catch(Error _ex) { }
    
Methods Summary
public java.awt.DimensiongetMinimumSize()

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

        return new Dimension(getSize().width, 22);
    
public java.lang.StringgetText()

        return headerText;
    
public voidpaint(java.awt.Graphics g)

        Dimension dimension = getSize();
        g.setClip(0, 0, dimension.width, dimension.height);
        FontMetrics fontmetrics = null;
        g.setColor(getBackground());
        g.fillRect(0, 0, dimension.width + 1, dimension.height + 1);
        g.setColor(getForeground());
        g.setFont(getFont());
        fontmetrics = Toolkit.getDefaultToolkit().getFontMetrics(getFont());
        int i = (dimension.height - (fontmetrics.getMaxAscent() + fontmetrics.getMaxDescent())) / 2 + fontmetrics.getMaxAscent();
        g.drawString(headerText, fontmetrics.stringWidth(""), i);
        int j = dimension.height - fontmetrics.getMaxDescent() / 2;
        g.drawLine(0, j, dimension.width, j);
    
public voidsetText(java.lang.String s)

        headerText = s;
        repaint();