Pages

Example to create Frame by Inheritance......

import java.awt.*;

class drawFrame extends Frame
{
    drawFrame() //constructor
    {
        setSize(400,400); //sets Frame size
        setLocation(500,350); //sets Frame Location
        setTitle("Hungry4java"); //sets Title of the frame
        setVisible(true); //sets the visible to user
       
    }
    public static void main(String[] args)
    {
        drawFrame f = new drawFrame(); //creating the object of class drawFarme.       
    }
}

1 comment:

  1. save your file as frame.java & compile it by writing drawFrame.....using cmd.
    see the picture above. if you are using eclipse or NetBeansIDE then you can run from there.

    ReplyDelete