public class Rect extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_HEIGHT
Default height of a Rect: 1.0px
|
static double |
DEFAULT_WIDTH
Default width of a Rect: 1.0px
|
| Constructor and Description |
|---|
Rect()
Creates a new Rect at (0,0) with default width and height.
|
Rect(double x,
double y,
double w,
double h)
Creates a new Rect with the given parameters.
|
Rect(Rect r)
Creates a new Rect using the same attributes values as the Rect given as
parameter.
|
| Modifier and Type | Method and Description |
|---|---|
double |
aspectRatio()
Calculates the Rect aspect ratio.
|
double |
getHeight()
get Height.
|
double |
getWidth()
Get width
|
double |
getX()
Get x position.
|
double |
getY()
get y position.
|
void |
setRect(double x,
double y,
double w,
double h)
Updates the Rect with the given parameters.
|
public static final double DEFAULT_WIDTH
public static final double DEFAULT_HEIGHT
public Rect()
public Rect(Rect r)
r - the Rect to be used for the attributespublic Rect(double x,
double y,
double w,
double h)
x - coordinates along the X axisy - coordinates along the Y axisw - widthh - heightpublic double aspectRatio()
public final void setRect(double x,
double y,
double w,
double h)
x - coordinates along the X axisy - coordinates along the Y axisw - widthh - heightpublic double getX()
public double getY()
public double getWidth()
public double getHeight()
Copyright © 2017 H-K. All rights reserved.