ClickAction
public class SquareShape extends Shape
Shape
, with multiple constructors to specify its
location, size, and color.Constructor | Description |
---|---|
SquareShape(int x,
int y) |
Builds a SquareShape at the x and y indices.
|
SquareShape(int x,
int y,
int size) |
Builds a SquareShape at the x and y indices.
|
SquareShape(int x,
int y,
int size,
java.awt.Color color) |
Builds a SquareShape using the given color, at the x and y indices, of
the size specified.
|
SquareShape(int x,
int y,
java.awt.Color color) |
Builds a SquareShape using the given color for the text color, at the x
and y indices.
|
Modifier and Type | Method | Description |
---|---|---|
void |
draw(java.awt.Graphics2D g) |
draw method (overridden)
|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, getHeight, getWidth, move, moveTo, onClick, onClick, onTimer, onTimer, remove, stopTimer
collidesWith, contains, getBackgroundColor, getBounds, getForegroundColor, getWindow, getX, getY, onClick, repaint, setBackgroundColor, setForegroundColor, setX, setY
public SquareShape(int x, int y)
x
- the x index in pixelsy
- the y index in pixelspublic SquareShape(int x, int y, int size)
x
- the x index in pixelsy
- the y index in pixelssize
- the width/height of your square in pixelspublic SquareShape(int x, int y, java.awt.Color color)
x
- the x index in pixelsy
- the y index in pixelscolor
- The text colorpublic SquareShape(int x, int y, int size, java.awt.Color color)
x
- the x index in pixelsy
- the y index in pixelssize
- the width and height of the squarecolor
- The text colorpublic void draw(java.awt.Graphics2D g)
draw
in class Shape
g
- graphics object from SwingShape.draw(java.awt.Graphics2D)