View Single Post
  #1 (permalink)  
Old 07-31-2007, 05:42 AM
barney barney is offline
Member
 
Join Date: Jul 2007
Posts: 40
barney is on a distinguished road
Help with game applet in java
Hi, I'm having trouble making a game work. I cant get my mouse to react to my applet at all. I've tried a few different methods, and a few different listeners types but haven't been successful with anything yet. Everything I have tried except for EventListeners has failed. I could use some serious help.
Her is what I have right now.

Code:
import java.awt.*; import java.awt.event.*; import java.applet.*; public class Catcher extends Applet implements MouseMotionListener{ int x_pos; int y_pos; public void init(){ addMouseMotionListener(this) } public void mouseMove(MouseEvent e){ int x_pos=e.getX(); } public void paint(Graphics g){ g.setColor(Color.blue); g.fillRect(x_pos-25,y_pos-5,50,10); } }
Is there anyone that has done Applet coding before that could help?
Thanks.
Reply With Quote
Sponsored Links