Search:

Type: Posts; User: Norm

Search: Search took 0.13 seconds.

  1. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Time for more debugging. Add a print out of the event passed to the actionPerformed method to see that it is called and to show what it is getting.
  2. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    You need to pass a reference to one class to the other. For example in Buttons pass a reference to itself (this) in the constructor of the Pushed class.
    Pushed pushed = new Pushed(this);
    and in...
  3. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    That's the code I had you put in for debugging. You can comment it out now. Its for the case where you want to see the call stack to show who called a method.
  4. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    What you've posted is the call stack which is verrrrrrrrrrrrrrrry long because of the recursion.

    Now look at your code and play computer with it. Where does the cross calls to the creation of the...
  5. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    What exceptions is it throwing? Please copy and paste the error message here.
  6. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Do you see the recursion?

    The Buttons class creates a Pushed object:
    Pushed pushed = new Pushed();

    The Pushed class creates a Buttons object:
    Buttons buttons = new Buttons();

    The Buttons...
  7. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Your code is recursively calling itself. Add print outs to both of the constructors to see what I mean.


    The following doesn't work because the problem is outside of the constructors.


    To...
  8. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    You can do that.

    Look at how you are calling the addActionListener method. What type is the argument passed in the method call?
  9. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Yes, the Button class has an addActionListener method
  10. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    You're missing my point. The Buttons class extends Applet. Neither of those two classes has a method: addActionListener


    This last error message you posted shows another class that does NOT have...
  11. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Does the Buttons class have a method: addActionListener()?
  12. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Does the Buttons class have a method: addActionListener()?

    What method contains the line with the errors?
  13. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Please copy the full text of the error messages and paste them here. Don't edit them.

    Where do you add an actionListener to the Button object?
Results 1 to 13 of 13