import java.awt.*;
import javax.swing.*;
public class JlabelDemo {
public static void main(String args [])
{
JFrame f = new JFrame ("Label Example");
Container c=f.getContentPane();
c.setLayout(new FlowLayout());
JLabel jlbLabel1 = new JLabel("Label1");
jlbLabel1.setVerticalTextPosition(JLabel.BOTTOM);
jlbLabel1.setHorizontalTextPosition(JLabel.CENTER);
JLabel jlbLabel2 = new JLabel("Label2");
JLabel jlbLabel3 = new JLabel("Label3");
c.add(jlbLabel1);
c.add(jlbLabel2);
c.add(jlbLabel3);
f.setSize(500,500);
f.setLocation(100,100);
f.setVisible(true);
}
}
OUTPUT :
No comments:
Post a Comment