Package com.github.ngoanh2n
Class Dimension
java.lang.Object
com.github.ngoanh2n.Dimension
A copy of java.awt.Dimension.
Repository:
Repository:
- GitHub: ngoanh2n/commons
- Maven: com.github.ngoanh2n:commons
- Since:
- 2021
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecH
(int value) Decrease height for thisDimension
byvalue
.decW
(int value) Decrease width for thisDimension
byvalue
.boolean
Check whether the currentDimension
equals to otherDimension
.int
Get height of thisDimension
.int
getWidth()
Get width of thisDimension
.incH
(int value) Increase height for thisDimension
byvalue
.incW
(int value) Increase width for thisDimension
byvalue
.setHeight
(int h) Set height for thisDimension
.setWidth
(int w) Set width for thisDimension
.toString()
Returns a string representation of thisDimension
.
-
Constructor Details
-
Dimension
public Dimension(int w, int h) - Parameters:
w
- The width of thisDimension
.h
- The height of thisDimension
.
-
Dimension
- Parameters:
other
- The sourceDimension
.
-
-
Method Details
-
getWidth
public int getWidth()Get width of thisDimension
.- Returns:
- The width of this
Dimension
.
-
setWidth
Set width for thisDimension
.- Parameters:
w
- The new width for thisDimension
.- Returns:
- This
Dimension
.
-
getHeight
public int getHeight()Get height of thisDimension
.- Returns:
- The height of this
Dimension
.
-
setHeight
Set height for thisDimension
.- Parameters:
h
- The new height for thisDimension
.- Returns:
- This
Dimension
.
-
incW
Increase width for thisDimension
byvalue
.- Parameters:
value
- The value to be added to width of thisDimension
.- Returns:
- This
Dimension
.
-
decW
Decrease width for thisDimension
byvalue
.- Parameters:
value
- The value to be subtracted to width of thisDimension
.- Returns:
- This
Dimension
.
-
incH
Increase height for thisDimension
byvalue
.- Parameters:
value
- The value to be added to height of thisDimension
.- Returns:
- This
Dimension
.
-
decH
Decrease height for thisDimension
byvalue
.- Parameters:
value
- The value to be subtracted to height of thisDimension
.- Returns:
- This
Dimension
.
-
equals
Check whether the currentDimension
equals to otherDimension
.- Parameters:
other
-Dimension
to be compared.- Returns:
true
if the currentDimension
equals to otherDimension
;false
otherwise.
-
toString
Returns a string representation of thisDimension
.
-