CODING:
import javax.swing.*;import java.awt.*;
class myjframe1 extends JFrame
{
public myjframe1()
{
setTitle("Fonts Of Label");
setDefaultCloseOperation(EXIT_ON_CLOSE);
JLabel l1= new JLabel("label without font");
JLabel l2= new JLabel("label with Serif Font");
JLabel l3= new JLabel("label with Broadway & Bold Font");
JLabel l4= new JLabel("label with Forte & Italic font");
l2.setFont(new Font("Serif", Font.PLAIN, 26));
l3.setFont(new Font("Broadway", Font.BOLD, 20));
l4.setFont(new Font("Forte", Font.ITALIC, 25));
setLayout(null);
l1.setBounds(50, 20, 200,100);
l2.setBounds(50, 60, 250,100);
l3.setBounds(50, 100, 500,100);
l4.setBounds(50, 150, 500,100);
add(l1);
add(l2);
add(l3);
add(l4);
setSize(300, 200);
setVisible(true);
}
}
class simpframe
{
public static void main(String args[])
{
myjframe1 x= new myjframe1();
}
}
0 comments:
Post a Comment