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.Hexagon
hexagon
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description HexagonAdapter(hexagon.Hexagon hexagon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HexagonAdapter
clone()
Make new instance of this class.int
compareTo(Shape hex)
Compares two hexagons depend on their radius.boolean
containsClick(int xCoordinate, int yCoordinate)
Check if hexagon is clicked.void
draw(java.awt.Graphics graphics)
Draw hexagon and check if it is selected, to mark and draw selected state too.boolean
equals(java.lang.Object obj)
Determine if two hexagons are equal depend on their x and y coordinates and radius length.void
fillUpShape(java.awt.Graphics shapeForFillUp)
Implemented indraw(Graphics)
.java.awt.Color
getColor()
java.awt.Color
getInteriorColor()
int
getR()
int
getXcoordinate()
int
getYcoordinate()
boolean
isSelected()
void
moveTo(int x, int y)
Move hexagon to given place.void
selected(java.awt.Graphics graphics)
Implemented indraw(Graphics)
.void
setColor(java.awt.Color color)
void
setInteriorColor(java.awt.Color color)
void
setR(int r)
void
setSelected(boolean selected)
java.lang.String
toString()
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:
equals
in 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:
toString
in 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:
containsClick
in 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:
clone
in classjava.lang.Object
- Returns:
- HexagonAdapter New instance of this class.
-
fillUpShape
public void fillUpShape(java.awt.Graphics shapeForFillUp)
Implemented indraw(Graphics)
.- Specified by:
fillUpShape
in classSurfaceShape
- Parameters:
Graphics
- {@docRoot#Graphics}
-
isSelected
public boolean isSelected()
- Overrides:
isSelected
in classShape
-
setSelected
public void setSelected(boolean selected)
- Overrides:
setSelected
in classShape
-
getInteriorColor
public java.awt.Color getInteriorColor()
- Overrides:
getInteriorColor
in classSurfaceShape
-
setInteriorColor
public void setInteriorColor(java.awt.Color color)
- Overrides:
setInteriorColor
in classSurfaceShape
-
getR
public int getR()
-
setR
public void setR(int r)
-
getXcoordinate
public int getXcoordinate()
-
getYcoordinate
public int getYcoordinate()
-
-