DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Thread: Maze code

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    2

    Maze code

    hello, I got this maze source code from the internet but I would like to change it so that the movement uses keypad (UP,DOWN,LEFT,RIGHT) instead of mouselistener

    Any help would be great (it is an Applet)

    here is the Source Code attached:
    Attached Files

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    So you're looking to create a KeyListener, which will listen to the keys you've indicated. Take a look at the API docs for the KeyListener interface.

  3. #3
    Join Date
    May 2006
    Posts
    2
    tried I changed all the mouse functions to use keylistener instead but I get these errors:

    H:\Java\maze\MazeApplet.java:365: cannot resolve symbol
    symbol : method getPoint ()
    location: class java.awt.event.KeyEvent
    Point p = new Point(e.getPoint());
    ^
    H:\Java\maze\MazeApplet.java:366: cannot resolve symbol
    symbol : method getX ()
    location: class java.awt.event.KeyEvent
    int x = e.getX();
    ^
    H:\Java\maze\MazeApplet.java:367: cannot resolve symbol
    symbol : method getY ()
    location: class java.awt.event.KeyEvent
    int y = e.getY();
    ^
    3 errors

  4. #4
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    H:\Java\maze\MazeApplet.java:365: cannot resolve symbol
    symbol : method getPoint ()
    location: class java.awt.event.KeyEvent
    Point p = new Point(e.getPoint());
    there is no getPoint() in KeyEvent class. there is no location for a key event at all. getX, getY are functions for a mouseevent, which has a location on the screen, and not for a keyevent, which has no location but the keyboard itself. remove all code corresponding to the location of the mouse.

Similar Threads

  1. wot is CLR
    By lostguy in forum .NET
    Replies: 8
    Last Post: 04-03-2002, 06:41 PM
  2. .NET equals Efficiency
    By Kevin in forum .NET
    Replies: 150
    Last Post: 03-04-2002, 05:40 PM
  3. Replies: 3
    Last Post: 07-09-2001, 03:25 PM
  4. Another Language
    By Steven Bell in forum .NET
    Replies: 260
    Last Post: 06-01-2001, 04:32 PM
  5. error code in JSP(please chek the code)
    By satish in forum Java
    Replies: 1
    Last Post: 09-22-2000, 09:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links