Wednesday, January 27, 2016

Program to create lalbel in frame.

import java.awt.*;
class Demo1_Label extends Frame
{
public static void main(String args[])
{
Label l1 =new Label(" Hello Java!!! ");
Demo1_Label f1 =new Demo1_Label();
f1.setTitle("Adding a Label in a Frame!!!");
f1.add(l1);
f1.resize(300,200);
f1.show( );
}
}
Output:

Friday, January 22, 2016

Program to create frame.

import java.awt.*;
class FrameDemo extends Frame
{
public FrameDemo(String title)
{
super(title); //calling constructor of base class Frame
    }
public static void main(String arg[])
{
FrameDemo f=new FrameDemo("I have been Framed!");
f.setSize(500,500);
f.setVisible(true);
}
}
Output: