Package fri.shapesge

Class Triangle


  • public class Triangle
    extends Object
    A triangle that can be manipulated and that draws itself on a canvas.
    • Constructor Detail

      • Triangle

        public Triangle()
        Create a new triangle at default position with default color.
      • Triangle

        public Triangle​(int x,
                        int y)
    • 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.