Dimension

Name

Dimension

[Graphic: Figure from the text]

Description

The Dimension class encapsulates width and height in a single object.

Class Definition

public class java.awt.Dimension extends java.lang.Object implements java.io.Serializable {
 // Variables public int height;
public int width; // Constructors public Dimension();
public Dimension (int width, int height);
public Dimension (Dimension d); // Instance Methods public boolean equals (Object obj); public Dimension getSize(); public void setSize (Dimension d); public void setSize (int width, int height); public String toString();
}

Variables

height

public int height

The height of the Dimension.

width

public int width

The width of the Dimension.

Constructors

Dimension

public Dimension()

public Dimension (int width, int height)

public Dimension (Dimension d)

Instance Methods

equals

public boolean equals (Object obj)

getSize

public Dimension getSize()

setSize

public void setSize (Dimension d)

public void setSize (int width, int height)

toString

public String toString()

See Also

Object, String, Serializable