Saturday, January 1, 2011

Add Label

import javax.swing.*;

class Label extends JFrame
{
   JLabel l;
 
   Label()
   {    
       add(l=new JLabel("Have a Nice Day"));
       l.setBounds(30,60,100,20);
   }
  
   public static void main(String[] args) 
   {
      JFrame win = new Label();
   
      win.setTitle("Label");
      win.setSize(200,200);
      win.setLayout(null);
      win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      win.setVisible(true);
   }  
}

Output

No comments: