⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 line.java

📁 第四次作业 1、 创建一个Animal(动物)类
💻 JAVA
字号:

public class Line extends GraphicObject {
	/**
	 * specific attributes that Line needs
	 */
	private Point origin;
	private Point end;
	
	Line(){
		super();
		origin = new Point(0,0);
		end = new Point(0,1);
	}
	
	Line(Point first,Point last, String color ){
		super(color,"null");
	    origin = first;
		end = last;
	}
		

	@Override
	public void draw() {
		// TODO Auto-generated method stub
		System.out.println("Draw the origin of the line is ("+origin.getX()+","+origin.getY()+").The end is(" +
				end.getX()+","+end.getY()+").color of the line is "+super.getColorOfLine());

	}

	@Override
	public void rotate() {
		// TODO Auto-generated method stub
		System.out.println("rotate this line");
		end.setNewPoint(2*origin.getX()-end.getX(),end.getY() );
		draw();
		

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -