Class Dimension

java.lang.Object
com.github.ngoanh2n.Dimension

@CanIgnoreReturnValue @ParametersAreNonnullByDefault public class Dimension extends Object
A copy of java.awt.Dimension.

Repository:
Since:
2021
  • Constructor Details

    • Dimension

      public Dimension(int w, int h)
      Construct a new Dimension by w, h.
      Parameters:
      w - The width of this Dimension.
      h - The height of this Dimension.
    • Dimension

      public Dimension(Dimension other)
      Construct a new Dimension by other Dimension.
      Parameters:
      other - The source Dimension.
  • Method Details

    • getWidth

      public int getWidth()
      Get width of this Dimension.
      Returns:
      The width of this Dimension.
    • setWidth

      public Dimension setWidth(int w)
      Set width for this Dimension.
      Parameters:
      w - The new width for this Dimension.
      Returns:
      This Dimension.
    • getHeight

      public int getHeight()
      Get height of this Dimension.
      Returns:
      The height of this Dimension.
    • setHeight

      public Dimension setHeight(int h)
      Set height for this Dimension.
      Parameters:
      h - The new height for this Dimension.
      Returns:
      This Dimension.
    • incW

      public Dimension incW(int value)
      Increase width for this Dimension by value.
      Parameters:
      value - The value to be added to width of this Dimension.
      Returns:
      This Dimension.
    • decW

      public Dimension decW(int value)
      Decrease width for this Dimension by value.
      Parameters:
      value - The value to be subtracted to width of this Dimension.
      Returns:
      This Dimension.
    • incH

      public Dimension incH(int value)
      Increase height for this Dimension by value.
      Parameters:
      value - The value to be added to height of this Dimension.
      Returns:
      This Dimension.
    • decH

      public Dimension decH(int value)
      Decrease height for this Dimension by value.
      Parameters:
      value - The value to be subtracted to height of this Dimension.
      Returns:
      This Dimension.
    • equals

      public boolean equals(Dimension other)
      Check whether the current Dimension equals to other Dimension.
      Parameters:
      other - Dimension to be compared.
      Returns:
      true if the current Dimension equals to other Dimension; false otherwise.
    • toString

      public String toString()
      Returns a string representation of this Dimension.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this Dimension.