FileDocCategorySizeDatePackage
Append.javaAPI DocExample2849Wed Aug 08 15:13:48 BST 2001demos.Paths

Append

public class Append extends Surface
Simple append of rectangle to path with & without the connect.

Fields Summary
Constructors Summary
public Append()

 
        setBackground(Color.white);
    
Methods Summary
public static voidmain(java.lang.String[] s)

        createDemoFrame(new Append());
    
public voidrender(int w, int h, java.awt.Graphics2D g2)

        GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
        p.moveTo(w*0.25f, h*0.2f);
        p.lineTo(w*0.75f, h*0.2f);
        p.closePath();
        p.append(new Rectangle2D.Double(w*.4, h*.3, w*.2, h*.1), false);
        g2.setColor(Color.gray);
        g2.fill(p);
        g2.setColor(Color.black);
        g2.draw(p);
        g2.drawString("Append rect to path", (int)(w*.25), (int)(h*.2)-5);

        p.reset();
        p.moveTo(w*0.25f, h*0.6f);
        p.lineTo(w*0.75f, h*0.6f);
        p.closePath();
        p.append(new Rectangle2D.Double(w*.4, h*.7, w*.2, h*.1), true);
        g2.setColor(Color.gray);
        g2.fill(p);
        g2.setColor(Color.black);
        g2.draw(p);
        g2.drawString("Append, connect", (int) (w*.25), (int) (h*.6)-5);