DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Streange error on key Listeners!

    Code:
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    
    
    public class f implements KeyListener  
                              
                                          {
    
    
    
    public static void main(String[] args  ){
    	
    }
    }
    Thats all i wrote so far and all redey i got the error :
    --------------------Configuration: <Default>--------------------
    C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\Snake\faris.java:7: faris is not abstract and does not override abstract method keyReleased(java.awt.event.KeyEvent) in java.awt.event.KeyListener
    public class faris extends JPanel implements KeyListener
    ^
    1 error

    Process completed.
    Can someone help me please.

  2. #2
    Join Date
    Nov 2006
    Posts
    35
    uhmm.. i see you are not familiar with abstract classes and interfaces....

    check

    http://java.sun.com/docs/books/tutor.../abstract.html
    http://java.sun.com/docs/books/tutor...interface.html

    you have to override/implement the keylistener's methods like this:



    import java.awt.event.*;


    public class f implements KeyListener {



    public static void main(String[] args ){

    }

    public void keyPressed(KeyEvent arg0) {

    }

    public void keyReleased(KeyEvent arg0) {

    }

    public void keyTyped(KeyEvent arg0) {

    }
    }


    and read something about SWING or awt. else you won't make it that far... a tutorial or something.

Similar Threads

  1. Database Design Help needed
    By Brian Pittman in forum Database
    Replies: 2
    Last Post: 04-29-2007, 08:23 AM
  2. Replies: 0
    Last Post: 09-21-2006, 08:19 AM
  3. Replies: 4
    Last Post: 03-16-2006, 05:23 PM
  4. Key violation error
    By trixma in forum Database
    Replies: 2
    Last Post: 05-21-2005, 10:07 PM
  5. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 03:53 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