Wednesday, 2 January 2013

Java Swing Label:- Label Program


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

/**
 *
 * @author Amol
 */
public class SwingLable extends JFrame {
    private JLabel msgLabel;
    private JLabel imgLabel;

    public SwingLable(){
        setTitle("Amol Window");
        setSize(300, 500);
        setLayout(null);
        initComponent();
    }
           private void  initComponent(){
               msgLabel=new JLabel("Hello");
               msgLabel.setBounds(20, 20, 70, 25);
               add(msgLabel);
               imgLabel=new JLabel(new ImageIcon("1152776623_1024x768_french-beauty-alizee.jpg"));
               imgLabel.setBounds(110, 20, 110, 80);
               add(imgLabel);
             
           }
           public static void main(String args[]){
               new SwingLable().setVisible(true);
           }


}

No comments:

Post a Comment