Class Dimension in Java

0
34
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

Class Dimension in Java
Class Dimension in Java

Class Dimension in Java:

This class encapsulates the width and height of a component into a single object. The class structure  of Class Dimension in Java is given as:

public class java.awt.Dimension extends java.lang.Object{
//member elements:
public int height;//height of the component
public int width;//width of the component
//constructors:
public Dimension();//creates a Dimension object with height and width as zero.
public Dimension(Dimension d);//Creates a Dimension whose width and height are
//same as provided in the given dimension.
public Dimension(int width,int height);//creates a Dimension with the specified
//width and height.
//Method
public String toString();
//Returns a String representation of the Dimension.
}
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here