Prog visual
/**
* A square that can be manipulated and that draws itself on a canvas.
*
* @author Michael Kölling and David J. Barnes
* @version 1.0 (15 July 2000)
*/
publicclass Rectangulo
{
private int size;
private int height;
private int width;
private int xPosition;
private int yPosition;
private String color;
private booleanisVisible;
/**
* Create a new square at default position with default color.
*/
public Rectangulo()
{
height = 50;
width = 80;
xPosition = 80;
yPosition =40;
color = "red";
isVisible = false;
}
/**
* This class represents a simple picture. You can draw the picture using
* the draw method. But wait, there's more: being anelectronic picture, it
* can be changed. You can set it to black-and-white display and back to
* colors (only after it's been drawn, of course).
*
* This class was written as an early example forteaching Java with BlueJ.
*
* @author Michael Kölling and David J. Barnes
* @version 1.1 (24 May 2001)
*/
public class Tren
{
private Square wall;
private Square window;private Triangle roof;
private Circle sun;
private Circle sun1;
private Circle sun2;
private Rectangulo tren1;
private Rectangulo2 techo;
private Square cuadro;/**
* Constructor for objects of class Picture
*/
public Tren()
{
// nothing to do... instance variables are automatically set to null
}
/**
* Drawthis picture.
*/
public void draw()
{
cola = new Rectangulo2();
cola.changeColor("yellow");
cola.moveHorizontal(-30);
cola.moveVertical(200);cola.makeVisible();
wall = new Square();
wall.moveVertical(80);
wall.changeSize(100);
wall.makeVisible();
techo = new...
Regístrate para leer el documento completo.