Results 1 to 3 of 3
  1. #1
    Antonio16 is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Default help with KeyTyped method from RobotCR class

    Hello guys, so I am working on a project using the becker file. I extended the RobotCR class so i could override the KeyTyped method but i am having some troubles.

    I would like to use the KeyTyped method to first(Select what robot the user wants to perfom a task), like if the user press the key A, then the robot labeled A will be selected and then if the user type another key such as m, then make the robot move.

    I am trying different things and I cant get to make it

    One of my attempt was

    protected void keyTyped(char key)
    {

    if (key == 'a') //a is the first robot and the robot which the user wants it to perform a mehtod
    {
    if (key == 'b')
    {
    //do something
    }
    }
    }

  2. #2
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: help with KeyTyped method from RobotCR class

    What does 'can't keep to make it' mean? Is there an error? Does the expected event not happen? Is the method called but does nothing?

    Please enclose your code in the forums code tags to make it readable. The code you present does nothing but should be ok so far - but make sure you have overwritten the correct method by using the @Override annotation.
    As I do not know the "becker" file I cannot comment on what I do not see.
    I like likes!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,237
    Rep Power
    19

    Default Re: help with KeyTyped method from RobotCR class

    Also, RobotCR isn't a part of the standard Java API so you probably need to ask wherever you got that class.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 1
    Last Post: 10-17-2011, 01:00 AM
  2. keyTyped is it correct
    By aizen92 in forum New To Java
    Replies: 18
    Last Post: 04-03-2011, 01:47 PM
  3. Nullifying Keypress or KeyTyped Event
    By tomtraxler in forum New To Java
    Replies: 3
    Last Post: 01-09-2011, 01:19 PM
  4. About focusLost and keyTyped, need feedback
    By mine0926 in forum NetBeans
    Replies: 0
    Last Post: 06-26-2010, 10:08 AM
  5. Char comparison/assigning through keyTyped
    By AdamMurg in forum Java Applets
    Replies: 0
    Last Post: 10-21-2009, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •