Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

void javamorph::CFrame::paint ( Graphics  g  )  [inline]

Paint this component to the screen. Call the decorators therefore.

Definition at line 98 of file CFrame.java.

References dmesh, dpicture, dpolygon, dpopup, moffline, javamorph::CPopupMenuDecorator::paint(), javamorph::CPolygonDecorator::paint(), javamorph::CMeshDecorator::paint(), and javamorph::CPictureDecorator::paint().

Referenced by update().

                                 {
        int r = 0, c = 0;
        Dimension size = this.getSize();
        /* Init double buffer. */
        this.moffline = new BufferedImage(
                size.width, 
                size.height, 
                BufferedImage.TYPE_INT_ARGB);
        Graphics o = this.moffline.getGraphics();
        o.setColor(this.getBackground());
        /* Draw checkerboard pattern. */
        for(int i = 0; i < size.width; i += 20, c += 1, r = 0){
            for(int j = 0; j < size.height; j +=  20, r += 1){
                if(0 == (c + r) % 2){
                    o.setColor(Color.lightGray);
                }else{
                    o.setColor(Color.gray);
                }
                o.fillRect(i, j, 20, 20);
            }
        }
        /* Set anit-alias. */
        ((Graphics2D)o).setRenderingHint
        (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        /* Call decorators. */
        dpicture.paint(o);
        dmesh.paint(o);
        dpolygon.paint(o);
        dpopup.paint(o);
        /* Draw onto screen. */
        g.drawImage(moffline, 0, 0, this);
    }


Generated by  Doxygen 1.6.0   Back to index