How do I determine the width and height of my application?

Use the getSize() method, which the Applet class inherits from the Component class in the Java.awt package. The getSize() method returns the size of the applet as a Dimension object, from which you extract separate width, height fields. The following code snippet explains this:
  1. Dimension dim = getSize();
  2. int appletwidth = dim.width();
  3. int appletheight = dim.height();

Search Topics

Popular Posts