Package math
Class Size
java.lang.Object
math.Size
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
getScaledInstance
(double scaleFactor) returns a new Size object scaled to the value given by scaleFactorgetScaledInstance
(double scaleWidth, double scaleHeight) returns a new Size object scaled to the value given by scaleWidth and scaleHeight, both being muktipliers for the width and the height.getSize()
double
getWidth()
void
scale
(double scaleFactor) void
setHeight
(double height) void
setSize
(double width, double height) void
void
setWidth
(double width) toString()
-
Field Details
-
width
public double width -
height
public double height
-
-
Constructor Details
-
Size
public Size(double width, double height) Creates a new object of this class.- Parameters:
width
- Stores the width.height
- Stores the height.
-
Size
Creates a Size object from a java.awt.Dimension object.- Parameters:
dim
- The givem Dimension object.
-
Size
Creates a new Size object from a given Size object. The created object is exactly similar in value to the given one, but is not the same as that one.It is a sort of twin.- Parameters:
size
- The given Size object.
-
-
Method Details
-
getHeight
public double getHeight()- Returns:
- The height
-
setHeight
public void setHeight(double height) - Parameters:
height
- sets the height
-
getWidth
public double getWidth()- Returns:
- the width
-
setWidth
public void setWidth(double width) - Parameters:
width
- sets the height
-
setSize
public void setSize(double width, double height) - Parameters:
width
- sets the width attribute of this objectheight
- sets the height attribute of this object
-
setSize
- Parameters:
size
- sets the size of object of this class using an already known one.
-
getSize
- Returns:
- a new instance of Size containing information about the size of this object
-
scale
public void scale(double scaleFactor) - Parameters:
scaleFactor
- the factor by which this Size object is to be scaled.
-
getScaledInstance
returns a new Size object scaled to the value given by scaleFactor- Parameters:
scaleFactor
- the factor by which this Size object is to be scaled.
-
getScaledInstance
returns a new Size object scaled to the value given by scaleWidth and scaleHeight, both being muktipliers for the width and the height.- Parameters:
scaleWidth
- the factor by which the width of this Size object is to be scaled.scaleHeight
- the factor by which the height of this Size object is to be scaled.
-
toString
-
getAWTDimension
- Returns:
- the Dimension object closest in value to this Size object.
-