Well,i'm new to Java and these days i practice with the acm.library. I have to create a house with 2 windows,a door and a roof. But,i want them centered in their positions, regardless the width and height of the shapes.
I just have centered the wall of the house,and right now i want some help about how to place the door at the center of the house and how to place the 2 windows right and left of the door.
EDIT : DONE with door and left window!!!
here is my code:
import acm.program.*;
import java.awt.*;
import acm.graphics.*;
public class home extends GraphicsProgram
{
public void run ()
{
double x = (getWidth() - FIGURE_WIDTH)/2 ;
double y = (getHeight() - FIGURE_HEIGHT) /2 ;
GRect rect = new GRect(x,y, FIGURE_WIDTH,FIGURE_HEIGHT);
rect.setFilled(false);
rect.setColor(Color.BLACK);
add(rect);
}
private static final double FIGURE_WIDTH = 480;
private static final double FIGURE_HEIGHT = 200;
}