Index: [thread] [date] [subject] [author]
  From: Huned M. Botee <huned.botee@duke.edu>
  To  : 
  Date: Tue, 13 Apr 1999 21:42:06 -0400

Re: bouncing (AND quick netscape java tip)

Although I didn't see anything wrong, I know it didn't work. I wrote a
little test program to see what the deal was:

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

public class HApplet extends Applet
{
    public void init()
    {
        addMouseListener(
            new MouseAdapter()
            {
                public void mouseClicked(MouseEvent e)
                {
                    System.out.println("hello fool!");
                }
            });
    }
    
}


It uses the mouse listener correctly. and it works.

Quick Tip: You can see what's going on Java-wise in Netscape
communicator! Click the "communicator" menu item, then "tools", then
"Java console". If you've used System.out.printlns in your applets,
they'll print out in the java console.

cheers folks

Yueyi Liu wrote:
> 
> I fixed the problem.  What I did is:
> 
>   myPlaypen.addMouseListener(  same code as below)
> 
> rather than "addMouseListener()" in MyApplet.java.
> 
> Any idea why this code works and my previous one won't?
> 
> 
> > could anyone help me figure out why this piece of code won't work?
> >
> >  addMouseListener( new MouseAdapter(){
> >        public void mouseClicked(MouseEvent e)
> >       {
> >         myPlaypen.addBall(images);
> >       }
> >       }
> >                       );
> >
> > This is in MyApplet.java.  What I am trying to do here is to add a ball
> > whenever the mouse is clicked.  But nothing happened when the mouse is
> > clicked.
> >
> >
> >
> >

-- 


Huned M. Botee
huned.botee@duke.edu


Index: [thread] [date] [subject] [author]