Re: Using implements Runnable and MouseListener
From: Chris (chris2k01_at_hotmail.com)
Date: 02/07/04
- Previous message: Raymond DeCampo: "Re: Execute Java in a new window"
- In reply to: Doug van Vianen: "Using implements Runnable and MouseListener"
- Next in thread: Doug van Vianen: "Re: Using implements Runnable and MouseListener"
- Reply: Doug van Vianen: "Re: Using implements Runnable and MouseListener"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 07 Feb 2004 20:10:06 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Doug van Vianen wrote:
> 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
Hi,
Although a class can only *extend* one other class, it can *implement*
any number of interfaces:
public class MyApplet extends Applet implements Runnable,
MouseListener {
...
}
Just keep adding more and more with commas until you have everything
you need.
- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAJRvynwjA8LryK2IRAvcUAJ4xuNa2psgGsLgpN9+BfNVa+7AKigCgql6r
cTiNtMqFqYlkeQ55JTD83Kk=
=lTT8
-----END PGP SIGNATURE-----
- Previous message: Raymond DeCampo: "Re: Execute Java in a new window"
- In reply to: Doug van Vianen: "Using implements Runnable and MouseListener"
- Next in thread: Doug van Vianen: "Re: Using implements Runnable and MouseListener"
- Reply: Doug van Vianen: "Re: Using implements Runnable and MouseListener"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|