Package Shapes

Class ShapeFactory

java.lang.Object
Shapes.ShapeFactory

public class ShapeFactory
extends java.lang.Object
makes new shapes with this factory, helps share settings throw different screens
Author:
Itay Finci
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  ShapeFactory.Shapes
    the shapes that the factory supports, and representing strings for them
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private static java.awt.Color color  
    private static javax.swing.JCheckBox filledBox  
    private static boolean makeFilled  
    private static int roundness  
    private static ShapeFactory.Shapes selectedShape  
    private static javax.swing.JSlider slider  
    private static int thickness  
  • Constructor Summary

    Constructors 
    Constructor Description
    ShapeFactory()  
  • Method Summary

    Modifier and Type Method Description
    static MyShape changeShape​(MyShape shape, java.awt.Point target)  
    static java.awt.Color getColor()
    get the selected color
    static int getRoundness()
    get the round % of new Rounded rectangle
    static ShapeFactory.Shapes getSelectedShape()
    get the shape that will be made if getShape is called
    static MyShape getShape​(java.awt.Point origin, java.awt.Point target)
    makes a new shape base of the settings of the factory and the parameters
    static int getThickness()  
    static void increaseLine​(int step)
    set the thickness value using the slider- in order to keep the UI updated
    static boolean isFilled()
    get if the shape will be filled or not
    static void setCheckFilled​(boolean filled)  
    static void setColor​(java.awt.Color c)
    sets the color that will be for new shapes
    static void setFilled​(boolean filled)
    set if the next shape should be filled
    static void setFilledBox​(javax.swing.JCheckBox box)  
    static void setRoundness​(int roundness)
    set how much of each line will turn to arch
    static void setSelectedShape​(ShapeFactory.Shapes shape)
    set the shape that will be drawn
    static void setSlider​(javax.swing.JSlider s)
    set the UI slider in use
    static void setThickness​(int thickness)
    set the thickness for the next created object

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getShape

      public static MyShape getShape​(java.awt.Point origin, java.awt.Point target)
      makes a new shape base of the settings of the factory and the parameters
      Parameters:
      origin - the origin point of the shape
      target - the end point of the shape
      Returns:
      the new shape object
    • changeShape

      public static MyShape changeShape​(MyShape shape, java.awt.Point target)
    • getColor

      public static java.awt.Color getColor()
      get the selected color
      Returns:
      the current color that will be given to new shapes
    • setColor

      public static void setColor​(java.awt.Color c)
      sets the color that will be for new shapes
      Parameters:
      c - the color to set
    • setSelectedShape

      public static void setSelectedShape​(ShapeFactory.Shapes shape)
      set the shape that will be drawn
      Parameters:
      shape - the shape to draw next
    • getSelectedShape

      public static ShapeFactory.Shapes getSelectedShape()
      get the shape that will be made if getShape is called
      Returns:
      a Shape enum var
    • isFilled

      public static boolean isFilled()
      get if the shape will be filled or not
      Returns:
      true if the next shape will be filled
    • setFilled

      public static void setFilled​(boolean filled)
      set if the next shape should be filled
      Parameters:
      filled - true if you want the next shape to be filled
    • setCheckFilled

      public static void setCheckFilled​(boolean filled)
    • setFilledBox

      public static void setFilledBox​(javax.swing.JCheckBox box)
    • getRoundness

      public static int getRoundness()
      get the round % of new Rounded rectangle
      Returns:
      the % of each line that turns to arc
    • setRoundness

      public static void setRoundness​(int roundness)
      set how much of each line will turn to arch
      Parameters:
      roundness - a integer between 0 to 100 that represent the % of the length that turns to arc
    • getThickness

      public static int getThickness()
      Returns:
      the current defined line thickness - this will be used for the next created shape unless changed
    • setThickness

      public static void setThickness​(int thickness)
      set the thickness for the next created object
      Parameters:
      thickness - the new thickness
    • increaseLine

      public static void increaseLine​(int step)
      set the thickness value using the slider- in order to keep the UI updated
      Parameters:
      step - the step value to take
    • setSlider

      public static void setSlider​(javax.swing.JSlider s)
      set the UI slider in use
      Parameters:
      s - the slider