Java-GetHeight and GetWidth

GetHeight and GetWidth

If you can get the width and height of the applet window through the methods getWidth() and getHeight().



Program Source

import java.applet.Applet
import java.awt.Graphics;

public class Javaapp extends Applet{
    public void paint(Graphics g)
        g.drawString("Height : "+getHeight()+"  Width : "+getWidth(), 10, 10); 
        g.fillOval(30, 30, getWidth()-60, getHeight()-60);

Leave a Comment