Tuesday, 2 February 2016

Make a Label in swing that is JLabel

Program

import javax.swing.*;
import java.awt.*;

public class IconFrame
{
  public static void main(String[] args)
  {

     JFrame f1;

     f1 = new JFrame("Welcome");

     JLabel l1;

     l1 = new JLabel("I love my college");
     l1.setForeground(Color.GREEN);
     f1.add(l1);
     f1.setLayout(new FlowLayout());
     f1.setVisible(true);
     f1.setSize(200,200);
     f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   

   }
}

Output


No comments:

Post a Comment