I have this much of the code for the shape and fill. I want the shape and fill to combine into one shape which will keep iits color and stroke, but could be transformed.

public class ShapeGraphics extends Applet {

public void init() {


}

public void paint(Graphics g) {

    super.paint(g);

    Graphics2D g2d = (Graphics2D)g;
    g2d.setStroke(new BasicStroke(4));
    g2d.setColor(Color.BLACK);
    Rectangle rect2= new Rectangle(47, 46, 127, 128);
    Rectangle rect3=new Rectangle(35,72,34,68);
    Color c1=new Color(255,0,0),c2=new Color(50,208,7),c3=new Color(40,166,243)
    ,c4=new Color(254,174,1);
    g2d.draw(rect2);


    //RED
    g2d.setColor(c1);
    g2d.fill(rect3);

    //GREEN
    g2d.setColor(c2);

    //BLUE
    g2d.setColor(c3);
    g2d.fill(rect2);

    /***********************************************************************************/
    //START OF LAYER 2
    //BLACK LINE!
    g2d.setColor(Color.BLACK);
    g2d.draw(rect3);

    //RED
    g2d.setColor(c1);
    g2d.fill(rect3);

    //Orange
    g2d.setColor(c4);


}}

The output is a blue square with a red rectangle. Thanks in Advance

0

There are 0 answers