Re: Using implements Runnable and MouseListener
From: hiwa (HGA03630_at_nifty.ne.jp)
Date: 02/08/04
- Next message: Nick Landsberg: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- Previous message: David Starner: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- In reply to: Doug van Vianen: "Using implements Runnable and MouseListener"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Feb 2004 16:46:56 -0800
"Doug van Vianen" <courses@shaw.ca> wrote in message news:<hZaVb.416128$JQ1.297480@pd7tw1no>...
> I am fairly new to Java but have written an applet that uses 'implements
> Runnable' to do some timing
> eg
> public class Puzzle extends Applet implements Runnable
> { etc.
>
> and also an applet which detects left, right and double mouse clicks using
> 'implements MouseListener'
> eg
> public class TestMouse extends Applet implements
> MouseListner { etc.
>
> I would now like to write an applet that uses both of these so that I can
> detect the mouse actions as well as do some timing.
>
> Could someone show me the structure that would be used to allow both
> implements Runnable and MouseListener in the same Java applet? This is
> probably quite obvious to a regular Java programmer but I am an old style
> programmer trying to convert to Java.
>
> Thank you.
> Doug van Vianen
> courses@shaw.ca
The most typically, timing thread, which is your runnable, does some
sleep() and call applet's repaint() -- that is it is a controller for
some animation. MouseListener will do whatever it likes in its various
methods.
- Next message: Nick Landsberg: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- Previous message: David Starner: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- In reply to: Doug van Vianen: "Using implements Runnable and MouseListener"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|