import java.awt.*;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.*;
public class FontSize extends JFrame{
private ImageIcon img=new ImageIcon("C:\\Users\\Public\\Pictures\\Sample Pictures\\a.jpg");
public FontSize()
{
JPanel p1=new JPanel(new GridLayout(1,1,5,5));
JButton b1=new JButton(img);
JButton b2=new JButton("Masood");
JButton b3=new JButton("Start");
b1.setBackground(Color.RED);
b2.setForeground(Color.ORANGE);
b3.setBackground(Color.YELLOW);
p1.setBorder(new TitledBorder("BEST PROGRAMMER NAME"));
Border LineBorder=new LineBorder(Color.BLACK,2);
Font size=new Font("TimeRoman",Font.BOLD,30);
b1.setFont(size);
b2.setFont(size);
b3.setFont(size);
b1.setBorder(LineBorder);
b2.setBorder(LineBorder);
b3.setBorder(LineBorder);
p1.add(b1);
p1.add(b2);
p1.add(b3);
add(p1);
}
}
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.*;
public class FontSize extends JFrame{
private ImageIcon img=new ImageIcon("C:\\Users\\Public\\Pictures\\Sample Pictures\\a.jpg");
public FontSize()
{
JPanel p1=new JPanel(new GridLayout(1,1,5,5));
JButton b1=new JButton(img);
JButton b2=new JButton("Masood");
JButton b3=new JButton("Start");
b1.setBackground(Color.RED);
b2.setForeground(Color.ORANGE);
b3.setBackground(Color.YELLOW);
p1.setBorder(new TitledBorder("BEST PROGRAMMER NAME"));
Border LineBorder=new LineBorder(Color.BLACK,2);
Font size=new Font("TimeRoman",Font.BOLD,30);
b1.setFont(size);
b2.setFont(size);
b3.setFont(size);
b1.setBorder(LineBorder);
b2.setBorder(LineBorder);
b3.setBorder(LineBorder);
p1.add(b1);
p1.add(b2);
p1.add(b3);
add(p1);
}
}
......................................................................................................................................................
public class TESTFont {
public static void main(String []args)
{
FontSize font=new FontSize();
font.setTitle("UMT SIALKOT");
font.setSize(450,450);
font.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
font.setLocationRelativeTo(null);
font.setVisible(true);
}
}
