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 classShapeFactory.Shapesthe shapes that the factory supports, and representing strings for them -
Field Summary
Fields Modifier and Type Field Description private static java.awt.Colorcolorprivate static javax.swing.JCheckBoxfilledBoxprivate static booleanmakeFilledprivate static introundnessprivate static ShapeFactory.ShapesselectedShapeprivate static javax.swing.JSlidersliderprivate static intthickness -
Constructor Summary
Constructors Constructor Description ShapeFactory() -
Method Summary
Modifier and Type Method Description static MyShapechangeShape(MyShape shape, java.awt.Point target)static java.awt.ColorgetColor()get the selected colorstatic intgetRoundness()get the round % of new Rounded rectanglestatic ShapeFactory.ShapesgetSelectedShape()get the shape that will be made if getShape is calledstatic MyShapegetShape(java.awt.Point origin, java.awt.Point target)makes a new shape base of the settings of the factory and the parametersstatic intgetThickness()static voidincreaseLine(int step)set the thickness value using the slider- in order to keep the UI updatedstatic booleanisFilled()get if the shape will be filled or notstatic voidsetCheckFilled(boolean filled)static voidsetColor(java.awt.Color c)sets the color that will be for new shapesstatic voidsetFilled(boolean filled)set if the next shape should be filledstatic voidsetFilledBox(javax.swing.JCheckBox box)static voidsetRoundness(int roundness)set how much of each line will turn to archstatic voidsetSelectedShape(ShapeFactory.Shapes shape)set the shape that will be drawnstatic voidsetSlider(javax.swing.JSlider s)set the UI slider in usestatic voidsetThickness(int thickness)set the thickness for the next created object
-
Field Details
-
selectedShape
-
makeFilled
private static boolean makeFilled -
roundness
private static int roundness -
color
private static java.awt.Color color -
thickness
private static int thickness -
filledBox
private static javax.swing.JCheckBox filledBox -
slider
private static javax.swing.JSlider slider
-
-
Constructor Details
-
ShapeFactory
public ShapeFactory()
-
-
Method Details
-
getShape
makes a new shape base of the settings of the factory and the parameters- Parameters:
origin- the origin point of the shapetarget- the end point of the shape- Returns:
- the new shape object
-
changeShape
-
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
set the shape that will be drawn- Parameters:
shape- the shape to draw next
-
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
-