java - The method toggleKey(int, boolean) is undefined for the type InputHandler -


i wandering if help, im following tuorial on input handling , tutorial reguires me create new class , write code.

package net.pinkeye.javagame;  import java.awt.event.keyevent; import java.awt.event.keylistener; import java.util.arraylist; import java.util.list;  public class inputhandler implements keylistener{  public inputhandler(game game) {     game.addkeylistener(this); }  public class key {     public boolean pressed = false;      public boolean ispressed(){         return pressed;     }     public void toggle(boolean ispressed) {         pressed = ispressed;     } }   public key = new key();   public key down = new key();     public key left = new key();     public key right = new key();  public void keypressed(keyevent e) {     togglekey(e.getkeycode(),true); }   public void keyreleased(keyevent e) {     togglekey(e.getkeycode(),false); }  public void keytyped(keyevent e) { }   public void toggle (int keycode, boolean ispressed) {     if(keycode == keyevent.vk_w){         up.toggle(ispressed);     }     if(keycode == keyevent.vk_s){         down.toggle(ispressed);     }     if(keycode == keyevent.vk_a){         left.toggle(ispressed);     }        if(keycode == keyevent.vk_d){         right.toggle(ispressed);     } }  } 

however says

    public void keypressed(keyevent e) {     togglekey(e.getkeycode(),true); }   public void keyreleased(keyevent e) {     togglekey(e.getkeycode(),false); } 

eclipse tells me method togglekey(int, boolean) undefined type inputhandler

ive followed tutorial word wrd , checked multiple times can't find mistake.

any great

btw here thwe tuorial if helps: http://www.youtube.com/watch?v=vv7g5gmore8

your actual method called toggle you've declared possibility of invoking togglekey. renaming toggle togglekey should solve problem.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -