import java.applet.*;
import java.awt.*;
public class JProject4 extends Applet
{
public void paint(Graphics Brush)
{
int CenterX,CenterY,Ax,Bx,Cx,Dx,Ex,Fx,Ay,By,Cy,Dy,Ey,Fy,Offset,Side,Row,Col;
Dimension RowCol;
RowCol = getSize();
Row = RowCol.width;
Col = RowCol.height;
Brush.setColor(Color.red);
Brush.drawLine(0,0,Row,0);
Brush.drawLine(0,Col-1,Row,Col-1);
Brush.drawLine(0,0,0,Col);
Brush.drawLine(Row-1,0,Row-1,Col);
Brush.drawLine(Row/2,0,Row/2,Col/2);
Brush.drawLine(0,Col/2,Row,Col/2);
// Square
Offset = Col/16;
CenterX = Row/4;
CenterY = Col/4;
Side = (int) ( ( Col/2 - 2 * Offset) );
Ax = CenterX - Side/2;
Ay = Offset;
Bx = CenterX + Side/2;
By = Ay;
Cx = Bx;
Cy = CenterY + Side/2;
Dx = Ax;
Dy = Cy;
Brush.setColor(Color.darkGray);
Brush.drawLine(Ax,Ay,Bx,By);
Brush.drawLine(Bx,By,Cx,Cy);
Brush.drawLine(Cx,Cy,Dx,Dy);
Brush.drawLine(Dx,Dy,Ax,Ay);
CenterX = 3 * Row/4;
CenterY = Col/4;
}
}