Package breadboards
Class GRect
- java.lang.Object
-
- breadboards.GObject
-
- breadboards.GRect
-
-
Constructor Summary
Constructors Constructor Description GRect(double width, double height)
constructs a GRect with specified width and height with upper left corner at (0,0)GRect(double x, double y, double width, double height)
constructs a GRect with a specified width and height at a specified location
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x, double y)
returns true if (x,y) is inside this GRectvoid
draw(java.awt.Graphics g)
draws the GRect (generally not called directly)GRectangle
getBounds()
returns the bounding rectangle for this GRectjava.awt.Color
getColor()
returns the border color of this GRectjava.awt.Color
getFillColor()
returns the fill color for this GRectdouble
getHeight()
returns the height of this GRectdouble
getWidth()
returns the width of this GRectboolean
isFilled()
returns whether or not this GRect should be displayed with an opaque interiorvoid
scale(double sf)
scale this GRect by a factor of sfvoid
scale(double sx, double sy)
scale the width of the GRect by a factor of sx and the height of the GRect by a factor of syvoid
setBounds(double x, double y, double width, double height)
set the width, height, and location of the GRect to the specified valuesvoid
setBounds(GRectangle bounds)
set the width, height, and location of the GRect to those associated with the specified bounding rectanglevoid
setColor(java.awt.Color color)
sets the border color of the GRect to the specified colorvoid
setFillColor(java.awt.Color fillColor)
set the fill color for the opaque interior to the specified colorvoid
setFilled(boolean isFilled)
this must be called for the GRect to show an opaque interiorvoid
setSize(double width, double height)
set the width and height of the GRect to the specified values-
Methods inherited from class breadboards.GObject
addMouseListener, addMouseMotionListener, getBreadboard, getLocation, getMouseListeners, getMouseMotionListeners, getParent, getX, getY, isVisible, move, movePolar, removeMouseListener, removeMouseMotionListener, sendBackward, sendForward, sendToBack, sendToFront, setLocation, setParent, setVisible, setX, setY, updateBreadboard
-
-
-
-
Constructor Detail
-
GRect
public GRect(double width, double height)
constructs a GRect with specified width and height with upper left corner at (0,0)- Parameters:
width
- the specified widthheight
- the specified height
-
GRect
public GRect(double x, double y, double width, double height)
constructs a GRect with a specified width and height at a specified location- Parameters:
x
- the x-coordinate of the upper left corner of the rectangley
- the y-coordinate of the upper left corner of the rectanglewidth
- the specified widthheight
- the specified height
-
-
Method Detail
-
getBounds
public GRectangle getBounds()
returns the bounding rectangle for this GRect
-
getColor
public java.awt.Color getColor()
returns the border color of this GRect- Returns:
- the border color of this GRect
-
getFillColor
public java.awt.Color getFillColor()
returns the fill color for this GRect- Returns:
- the fill color for this GRect
-
getHeight
public double getHeight()
returns the height of this GRect- Returns:
- the height of this GRect
-
getWidth
public double getWidth()
returns the width of this GRect- Returns:
- the width of this GRect
-
isFilled
public boolean isFilled()
returns whether or not this GRect should be displayed with an opaque interior- Returns:
- true if an opaque interior should be used, false otherwise
-
setColor
public void setColor(java.awt.Color color)
sets the border color of the GRect to the specified color- Parameters:
color
- the specified color
-
setFilled
public void setFilled(boolean isFilled)
this must be called for the GRect to show an opaque interior- Parameters:
isFilled
- true if an opaque interior is to be displayed, false otherwise
-
setFillColor
public void setFillColor(java.awt.Color fillColor)
set the fill color for the opaque interior to the specified color- Parameters:
fillColor
- the specified color
-
setSize
public void setSize(double width, double height)
set the width and height of the GRect to the specified values- Parameters:
width
- the specified widthheight
- the specified height
-
setBounds
public void setBounds(double x, double y, double width, double height)
set the width, height, and location of the GRect to the specified values- Parameters:
x
- x-coordinate of the upper left corner of the GRecty
- y-coordinate of the upper left corner of the GRectwidth
- width the specified widthheight
- height the specified height
-
setBounds
public void setBounds(GRectangle bounds)
set the width, height, and location of the GRect to those associated with the specified bounding rectangle- Parameters:
bounds
- a bounding rectangle for the GRect with the same dimensions and location
-
contains
public boolean contains(double x, double y)
returns true if (x,y) is inside this GRect
-
scale
public void scale(double sx, double sy)
scale the width of the GRect by a factor of sx and the height of the GRect by a factor of sy- Parameters:
sx
- the horizontal scaling factorsy
- the vertical scaling factor
-
scale
public void scale(double sf)
scale this GRect by a factor of sf- Parameters:
sf
- the scaling factor
-
draw
public void draw(java.awt.Graphics g)
draws the GRect (generally not called directly)
-
-