Get Some Free Products at your Door Step. Just feed ur Address in dis Link...!!

Tuesday, November 8, 2011

Font Handling Program in Java

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;

public class fontex implements ActionListener
{
JFrame f = new JFrame("Font");
JButton b = new JButton("Click me");
JTextArea jt = new JTextArea("Simple Text");

public static void main(String a[])
{
fontex fx= new fontex();
fx.design();
}
public void design()
{
f.getContentPane().add(BorderLayout.CENTER,jt);
f.getContentPane().add(BorderLayout.EAST,b);
b.addActionListener(this);
f.setSize(500,500);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
Font f =new Font("Arial",Font.BOLD|Font.ITALIC,25);
jt.setFont(f);
}
}

No comments:

Post a Comment