Package fri.shapesge
Class Triangle
- java.lang.Object
-
- fri.shapesge.Triangle
-
public class Triangle extends Object
A triangle that can be manipulated and that draws itself on a canvas.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeColor(String newColor)Change the color.voidchangeSize(int newHeight, int newWidth)Change the size to the new size (in pixels).voidmakeInvisible()Make this triangle invisible.voidmakeVisible()Make this triangle visible.voidmoveDown()Move the triangle a few pixels down.voidmoveHorizontal(int distance)Move the triangle horizontally by 'distance' pixels.voidmoveLeft()Move the triangle a few pixels to the left.voidmoveRight()Move the triangle a few pixels to the right.voidmoveUp()Move the triangle a few pixels up.voidmoveVertical(int distance)Move the triangle vertically by 'distance' pixels.
-
-
-
Method Detail
-
makeVisible
public void makeVisible()
Make this triangle visible. If it was already visible, do nothing.
-
makeInvisible
public void makeInvisible()
Make this triangle invisible. If it was already invisible, do nothing.
-
moveRight
public void moveRight()
Move the triangle a few pixels to the right.
-
moveLeft
public void moveLeft()
Move the triangle a few pixels to the left.
-
moveUp
public void moveUp()
Move the triangle a few pixels up.
-
moveDown
public void moveDown()
Move the triangle a few pixels down.
-
moveHorizontal
public void moveHorizontal(int distance)
Move the triangle horizontally by 'distance' pixels.
-
moveVertical
public void moveVertical(int distance)
Move the triangle vertically by 'distance' pixels.
-
changeSize
public void changeSize(int newHeight, int newWidth)Change the size to the new size (in pixels). Size must be greater or equal 0.
-
changeColor
public void changeColor(String newColor)
Change the color.
-
-