Package adapter
Class HexagonAdapter
- java.lang.Object
-
- shapes.Shape
-
- shapes.SurfaceShape
-
- adapter.HexagonAdapter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<Shape>,Movable
public class HexagonAdapter extends SurfaceShape
Class that is adapter for hexagon.jar library (Hexagon class).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private hexagon.Hexagonhexagonprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description HexagonAdapter(hexagon.Hexagon hexagon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HexagonAdapterclone()Make new instance of this class.intcompareTo(Shape hex)Compares two hexagons depend on their radius.booleancontainsClick(int xCoordinate, int yCoordinate)Check if hexagon is clicked.voiddraw(java.awt.Graphics graphics)Draw hexagon and check if it is selected, to mark and draw selected state too.booleanequals(java.lang.Object obj)Determine if two hexagons are equal depend on their x and y coordinates and radius length.voidfillUpShape(java.awt.Graphics shapeForFillUp)Implemented indraw(Graphics).java.awt.ColorgetColor()java.awt.ColorgetInteriorColor()intgetR()intgetXcoordinate()intgetYcoordinate()booleanisSelected()voidmoveTo(int x, int y)Move hexagon to given place.voidselected(java.awt.Graphics graphics)Implemented indraw(Graphics).voidsetColor(java.awt.Color color)voidsetInteriorColor(java.awt.Color color)voidsetR(int r)voidsetSelected(boolean selected)java.lang.StringtoString()Print hexagon values.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
hexagon
private hexagon.Hexagon hexagon
-
-
Method Detail
-
draw
public void draw(java.awt.Graphics graphics)
Draw hexagon and check if it is selected, to mark and draw selected state too.
-
equals
public boolean equals(java.lang.Object obj)
Determine if two hexagons are equal depend on their x and y coordinates and radius length.- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(Shape hex)
Compares two hexagons depend on their radius.
-
toString
public java.lang.String toString()
Print hexagon values.- Overrides:
toStringin classjava.lang.Object
-
moveTo
public void moveTo(int x, int y)Move hexagon to given place.- Parameters:
x- X coordinate of place to move.y- Y coordinate of place to move.
-
selected
public void selected(java.awt.Graphics graphics)
Implemented indraw(Graphics).
-
containsClick
public boolean containsClick(int xCoordinate, int yCoordinate)Check if hexagon is clicked.- Specified by:
containsClickin classShape- Parameters:
X- coordinate of click.Y- coordinate of click.- Returns:
- boolean Indicate if hexagon contains click.
-
clone
public HexagonAdapter clone()
Make new instance of this class.- Overrides:
clonein classjava.lang.Object- Returns:
- HexagonAdapter New instance of this class.
-
fillUpShape
public void fillUpShape(java.awt.Graphics shapeForFillUp)
Implemented indraw(Graphics).- Specified by:
fillUpShapein classSurfaceShape- Parameters:
Graphics- {@docRoot#Graphics}
-
isSelected
public boolean isSelected()
- Overrides:
isSelectedin classShape
-
setSelected
public void setSelected(boolean selected)
- Overrides:
setSelectedin classShape
-
getInteriorColor
public java.awt.Color getInteriorColor()
- Overrides:
getInteriorColorin classSurfaceShape
-
setInteriorColor
public void setInteriorColor(java.awt.Color color)
- Overrides:
setInteriorColorin classSurfaceShape
-
getR
public int getR()
-
setR
public void setR(int r)
-
getXcoordinate
public int getXcoordinate()
-
getYcoordinate
public int getYcoordinate()
-
-