에서 나는이 그림과 같이 Java로 사각형을 그릴 노력하고 있어요 이 : 나는 임은 몇도 있었지만 어떻게해야 누락 알고 그리기 사각형 자바
? (색상 편집됩니다)public class BlockTower
{
public static void main(String[] args)
{
Rectangle rect1 = new Rectangle(20, 70, 40, 30);
rect1.draw();
rect1.setColor(Color.BLUE);
rect1.fill();
Rectangle rect2 = new Rectangle(60, 70, 40, 30);
rect2.draw();
rect2.setColor(Color.MAGENTA);
rect2.fill();
Rectangle rect3 = new Rectangle(100, 70, 40, 30);
rect3.draw();
rect3.setColor(Color.CYAN);
rect3.fill();
Rectangle rect4 = new Rectangle(40, 100, 40, 30);
rect4.draw();
rect4.setColor(Color.RED);
rect4.fill();
Rectangle rect5 = new Rectangle(80, 100, 40, 30);
rect5.draw();
rect5.setColor(Color.PINK);
rect5.fill();
Rectangle rect6 = new Rectangle(60, 130, 40, 30);
rect6.draw();
rect6.setColor(Color.BLUE);
rect6.fill();
//TODO finish the draft to display the six blocks
}
}
Android와 어떤 관련이 있습니까? –
Android가 Java를 기반으로한다는 것을 알고 있습니다. –
@ S.Sahin 안드로이드와 연결이 없기 때문에 귀하의 질문은 자바 질문으로 분류 될 수 있습니다. 그냥 순수 자바 코드. – deadfish