FileDocCategorySizeDatePackage
JMPanel.javaAPI DocJMF 2.1.1e4066Mon May 12 12:20:30 BST 2003jmapps.ui

JMPanel

public class JMPanel extends Panel

Fields Summary
private static final int
TYPE_EMPTY
private static final int
TYPE_ETCHED
private static final int
TYPE_RAISED
private static final int
TYPE_LOWERED
private Insets
insetsBorder
private int
nType
Constructors Summary
public JMPanel()



       
        super ();
    
public JMPanel(LayoutManager managerLayout)

        super ( managerLayout );
    
Methods Summary
public voiddoLayout()

        int         i;
        int         nCount;
        Component   component;

        super.doLayout ();

        nCount = this.getComponentCount ();
        for ( i = 0;  i < nCount;  i++ ) {
            component = this.getComponent ( i );
            if ( component != null  &&  component instanceof Container )
                ((Container)component).doLayout();
        }
    
protected java.awt.FramegetFrame()

    	Frame		frame = null;
    	Component	comp;

    	comp = this;
    	while ( comp != null ) {
    	    if ( comp instanceof Frame ) {
    	    	frame = (Frame) comp;
    	    	break;
    	    }
    	    comp = comp.getParent ();
    	}
    	return ( frame );
    
public java.awt.InsetsgetInsets()

        return ( insetsBorder );
    
public voidpaint(java.awt.Graphics graphics)

        Color           colorBg;
        Color           colorTs;
        Color           colorBs;
        Dimension       dim;

        super.paint ( graphics );

        colorBg = this.getBackground ();
        colorTs = colorBg.brighter ();
        colorBs = colorBg.darker ();

        dim = this.getSize ();

        if ( nType == TYPE_ETCHED ) {
            graphics.setColor ( colorBs );
            graphics.drawRect ( 0, 0, dim.width - 2, dim.height - 2 );
            graphics.setColor ( colorTs );
            graphics.drawRect ( 1, 1, dim.width - 2, dim.height - 2 );
        }
        else if ( nType == TYPE_RAISED ) {
            graphics.setColor ( colorTs );
            graphics.drawLine ( 0, 0, dim.width - 1, 0 );
            graphics.drawLine ( 1, 1, dim.width - 2, 1 );
            graphics.drawLine ( 0, 0, 0, dim.height - 1 );
            graphics.drawLine ( 1, 1, 1, dim.height - 2 );

            graphics.setColor ( colorBs );
            graphics.drawLine ( 2, dim.height - 2, dim.width - 1, dim.height - 2 );
            graphics.drawLine ( 1, dim.height - 1, dim.width - 2, dim.height - 1 );
            graphics.drawLine ( dim.width - 2, 2, dim.width - 2, dim.height - 2 );
            graphics.drawLine ( dim.width - 1, 1, dim.width - 1, dim.height - 1 );
        }
        else if ( nType == TYPE_LOWERED ) {
            graphics.setColor ( colorBs );
            graphics.drawLine ( 0, 0, dim.width - 1, 0 );
            graphics.drawLine ( 0, 0, 0, dim.height - 1 );

            graphics.setColor ( colorTs );
            graphics.drawLine ( 1, dim.height - 1, dim.width - 2, dim.height - 1 );
            graphics.drawLine ( dim.width - 1, 1, dim.width - 1, dim.height - 1 );
        }
    
public voidsetEmptyBorder(int nLeft, int nTop, int nRight, int nBottom)

        insetsBorder.left = nLeft;
        insetsBorder.top = nTop;
        insetsBorder.right = nRight;
        insetsBorder.bottom = nBottom;

        nType = TYPE_EMPTY;
    
public voidsetEtchedBorder()

        insetsBorder.left = 8;
        insetsBorder.top = 8;
        insetsBorder.right = 8;
        insetsBorder.bottom = 8;

        nType = TYPE_ETCHED;
    
public voidsetLoweredBorder()

        insetsBorder.left = 1;
        insetsBorder.top = 1;
        insetsBorder.right = 1;
        insetsBorder.bottom = 1;

        nType = TYPE_LOWERED;
    
public voidsetRaisedBorder()

        insetsBorder.left = 2;
        insetsBorder.top = 2;
        insetsBorder.right = 2;
        insetsBorder.bottom = 2;

        nType = TYPE_RAISED;