Search:

Type: Posts; User: mjpam

Search: Search took 0.09 seconds.

  1. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    I understand what what you recommended I do: create a class whose constructor class the constructor of another class using the object created by the first constructor call as an argument to create an...
  2. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    So is the applet actually throwing an exception when the code is commented out?

    The problem that I am having is that, with the call to the Pushed constructor in the Buttons class commented out,...
  3. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Here are the exceptions that the applet throws:


    java.lang.Exception: who called?
    at Buttons.<init>(Buttons.java:20)
    at...
  4. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    I don't know and I can't copy and paste them here because they have been run off the window before I can stop the applet.

    All I get is:


    at Pushed.<init>(Pushed.java:7)
    at...
  5. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    I should have been more clear. I did see the recursion, but I was asking about why it was throwing exceptions and how I could get it to print the exceptions and their causes.
  6. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Can you show where to add the try/throw/catch blocks to get the stack trace to print?

    I have modified my code like this:

    import java.applet.*;
    import java.awt.*;

    /*
    <applet code =...
  7. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    I see it now: the documentation say the addActionListener() method must take an ActionListener argument.

    I'm sorry that my understanding is torturously slow in coming. I think that part of my...
  8. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    So why can't I add an ActionListener to a Button object inside the Buttons object?

    I understand that I can't add the ActionListener to the Buttons buttons object because the class of which it is...
  9. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    I'm confused because, in the past, I have been able to add ActionListeners to Button objects in Applet classes.

    For instance the following code compiles and runs as desired:

    import...
  10. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Not unless I implement the ActionListener interface on it.

    When I implement ActionListener on Buttons and put buttons.addActionListener(buttons.button) in side the constructor in the Pushed class,...
  11. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    A reference to a Pushed object?

    How do I add an ActionListener to the Button object in the GUI if the Pushed object contains no Button objects?
  12. Replies
    26
    Views
    5,260

    Re: Object-oriented applet

    Here are the compiler error I get when I try to compile:


    Buttons.java with the Pushed object in line 12 of Buttons.java not commented out

    .\Pushed.java:7: <identifier> expected
    ...
  13. Replies
    26
    Views
    5,260

    Object-oriented applet

    I'm trying to get these two classes to work together:


    import java.applet.*;
    import java.awt.*;

    /*
    <applet code = Buttons.java width = 100 height = 100> </applet>
    */
Results 1 to 13 of 13