Search:

Type: Posts; User: Norm

Search: Search took 0.14 seconds.

  1. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    class TheBannerRunner extends Runnable {
    Label theLabel;

    public TheBannerRunner(Label theLabel) {
    this.theLabel = theLabel; // Save the reference to the label we're to update
    }
    ...
  2. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    How to pass a reference to a class?
    A couple of ways:
    In the constructor.
    In a settor method.

    Another approach would be to have your banner class extend the label class and have the Applet...
  3. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Not sure what that means.
    The thread will started with a reference to the Label which is shown in the Applet's GUI. It can change the contents of the label and tell the applet to repaint its GUI to...
  4. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    The place I'm talking about is GUI. Something like a JLabel in the applets GUI area.

    In the applet you create a Thread object and start it. Say in the init() or start() method.
  5. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Take a two step approach.
    First create the Calculator applet with a place that shows the banner.
    Then add a thread to move the contents of the place holding the banner.
  6. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    You must put the method calls(the add()s) inside of a method. They appear to be outside with the variable defs.
  7. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Why do you have two classes that extend Applet? Only one of them is used by the browser as an applet. The CalculatorApplet class's methods (init and start) are NOT going to be called by the...
  8. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Look at the Double class and see if there are any methods or values you can use to test the results against.
  9. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Put the banner on a thread. Leave the calculator as you normally would.
    For NaN, how do you detect divide by 0? try{}catch(){}
    Compute the result and put it in a String. If you detect div by 0, set...
  10. Replies
    22
    Views
    3,259

    Re: Creating a threaded applet

    Can you explain what the calculator class is supposed to do?
    The banner class I guess should have a panel where it can change the contents like a scrolling banner.
    But why put the calculator on its...
Results 1 to 10 of 10