import java.awt.FlowLayout;
import
java.awt.event.ActionEvent;
import
java.awt.event.ActionListener;
import javax.swing.*;
public class pledge extends JFrame implements ActionListener{
private JTextArea text;
private JTextField doner;
private JTextField charity;
private JTextField pledge;
private JButton done;
private JLabel d;
private JLabel c;
private JLabel p;
pledge(){
setLayout(new FlowLayout());
doner=new JTextField(20);
charity=new JTextField(20);
pledge=new JTextField(20);
text=new JTextArea(6,30);
done =new JButton("Done");
d =new JLabel("Name of
Donor");
c =new JLabel("Name of
Charity");
p =new JLabel("Amount of
Pledge");
add(d);
add(doner);
add(c);
add(charity);
add(p);
add(pledge);
add(done);
add(text);
done.addActionListener(this);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400,255);
}
public static void main(String[] args)
{
// TODO Auto-generated
method stub
pledge
a=new pledge();
a.setVisible(true);
}
@Override
public void
actionPerformed(ActionEvent arg0) {
// TODO Auto-generated
method stub
text.setText(doner.getText()+ "\n"+ charity.getText()+ "\n" + pledge.getText());
}
}
Program Screenshots:
No comments:
Post a Comment