Streange error on key Listeners!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Streange error on key Listeners!

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

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center