Applet (Event Handling)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vabsjava
    New Member
    • Oct 2006
    • 22

    #1

    Applet (Event Handling)

    Is it possible to use as follows in same class

    public void actionPerformed (ActionEvent ae)
    {


    }

    and


    public void actionPerformed (ActionEvent e)
    {


    }



    actually i want to program the event handling of buttons as well as checkboxGroup.. ..

    Please Suggest me something.....
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by vabsjava
    Is it possible to use as follows in same class

    public void actionPerformed (ActionEvent ae)
    {


    }

    and


    public void actionPerformed (ActionEvent e)
    {


    }



    actually i want to program the event handling of buttons as well as checkboxGroup.. ..

    Please Suggest me something.....
    NO! It's not allowed. You cannot define a method with the same signature as another in that same class.
    You can set an action command for the button eg

    Code:
    button = new JButton("Click Here");
    button.setActionCommand("Click Here");
    in the actionPerformed do
    Code:
    String command = ae.getActionCommand();
    if(command.equals("Click Here")) {
        //click here button
    }

    Comment

    Working...