import java.awt.*;
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.event.*;
import javax.swing.event.*;
public class Display extends JFrame implements ActionListener
{
JLabel l1,l2,l3,l;
JTextField t1,t2;
JTextArea ta,ta1;
JButton b;
Display()
{
super("Sending Message");
l=new JLabel("Sending Message");
l1=new JLabel("Enter To Address :");
l2=new JLabel("Enter Subject :");
l3=new JLabel("Enter Your Message:");
t1=new JTextField(20); t2=new JTextField(20);
ta=new JTextArea("",20,20); ta1=new JTextArea("",20,20);
b=new JButton("Send");
setSize(410,450);
setResizable(false);
setLayout(null);
add(l).setBounds(80,1,150,50);
add(l1).setBounds(10,60,150,20); add(t1).setBounds(150,60,200,20);
add(l2).setBounds(10,90,150,20); add(t2).setBounds(150,90,200,20);
add(l3).setBounds(10,110,150,20); add(ta1).setBounds(150,130,200,100);
add(b).setBounds(150,250,120,20);
add(ta).setBounds(150,300,200,100);
b.addActionListener(this);
addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b)
ta.insert("The Following Message"+"\n'"+ta1.getText()+"'\n\n"+"is Send To "+t1.getText()+"\nWith the Following subject\n"+t2.getText(),0);
}
public static void main(String str[])
{
Display l=new Display();
l.setVisible(true);
}
}
No comments:
Post a Comment