Results 1 to 2 of 2
  1. #1
    manish007g is offline Member
    Join Date
    Apr 2011
    Posts
    7
    Rep Power
    0

    Default please help .... i got problem in event handling

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;


    class manis implements ActionListener
    {

    Frame f;
    Button b1;
    TextField t1;
    TextField t2;
    TextArea ta;

    manis()
    {
    Frame f=new Frame("Framer");
    f.setSize(400,400);
    Button b1=new Button ("display");
    f.add(b1);
    b1.addActionListener(this);
    TextField t1=new TextField();
    f.add(t1);
    TextField t2=new TextField();
    f.add(t2);
    TextArea ta=new TextArea();
    f.add(ta);
    f.setLayout(new FlowLayout());
    f.setVisible(true);


    }

    public void actionPerformed(ActionEvent e)
    {
    String s1=t1.getText();
    String s2=t2.getText();
    ta.setText(s1+s2);
    }

    public static void main(String s[])
    {
    new manis();
    }
    }

  2. #2
    manish007g is offline Member
    Join Date
    Apr 2011
    Posts
    7
    Rep Power
    0

    Default Re: please help .... i got problem in event handling

    [QUOTE=manish007g;245512]import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;


    class manis implements ActionListener
    {

    Frame f;
    Button b1;
    TextField t1;
    TextField t2;
    TextArea ta;

    manis()
    {
    Frame f=new Frame("Framer");
    f.setSize(400,400);
    Button b1=new Button ("display");
    f.add(b1);
    b1.addActionListener(this);
    TextField t1=new TextField();
    f.add(t1);
    TextField t2=new TextField();
    f.add(t2);
    TextArea ta=new TextArea();
    f.add(ta);
    f.setLayout(new FlowLayout());
    f.setVisible(true);


    }

    public void actionPerformed(ActionEvent e)
    {
    String s1=t1.getText();
    String s2=t2.getText();
    ta.setText(s1+s2);
    }

    public static void main(String s[])
    {
    new manis();
    }
    }


    i want that on pressing button "display" the content of both textfields get set on textarea .....
    but its not happening with the above code .....

Similar Threads

  1. Event handling
    By smallmos1 in forum New To Java
    Replies: 7
    Last Post: 11-24-2010, 08:22 PM
  2. Event Handling
    By zzpprk in forum AWT / Swing
    Replies: 2
    Last Post: 11-12-2009, 09:30 PM
  3. Event handling... help?
    By kevzspeare in forum New To Java
    Replies: 2
    Last Post: 04-04-2009, 08:46 PM
  4. SWT Event Handling
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-30-2007, 12:21 PM
  5. problem with event handling!!!
    By ahdus in forum Java Applets
    Replies: 1
    Last Post: 11-17-2007, 06:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •