To determine the width and height of an application, which of the following method is used?

Options
- getWidthHeight()
- setWidthHeight()
- getSize()
- setHeightWidth()


CORRECT ANSWER : getSize()

Discussion Board
java applet

This tutor is very help full.
Thank''s ,
I don''t know who u are ,
but u are best

priyesh 04-7-2019 09:08 AM

getSize()

getSize() is used to determine the height and width of the application as running inside a web browser the size of an applet is set by the height and width attributes and cannot be changed by the applet. Many applets need to know their own size as its not feasible to draw outside the lines. Getting applet size with getSize() is simple as java.applet.Applet inherits this method from java.awt.Component. getSize() returns a java.awt.Dimension object.

A Dimension object has two public int fields, height and width. Below is a simple applet that prints its own dimensions. So, it is used as getSize().width and getSize().height.

Rohit Sharma 09-30-2014 04:10 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement