Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: How do I make keybindings?

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How do I make keybindings?

    I am trying to make new keybindings to modify a game I play called Minecraft. But I need a map of the keyboard with the number codes (or whatever they are called). A downloadable image would be best so I can always have it. Please help me!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How do I make keybindings?

    For the KeyEvent codes, see the KeyEvent class API doc. It defines the variable names for the code values.

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I make keybindings?

    okay ill check that, if it is what i need, i will then mark as solved

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I make keybindings?

    well, I found something with stuff like VK_ALT, but i need actual numbers

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How do I make keybindings?

    Quote Originally Posted by JustForLawls View Post
    well, I found something with stuff like VK_ALT, but i need actual numbers
    The numbers for these constants should be outlined in the javadoc API.
    Constant Field Values (Java Platform SE 6)

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How do I make keybindings?

    i need actual numbers
    If you read the API doc you will see that all the VK_xxx variables are ints. IE they are all numbers.
    Hardcoding magic numbers in a program is NOT a good style. Using named variables makes the code easier to understand and to maintain.
    If you see: if( code == 65)
    what letter is that refering to?
    if you see: if (code == KeyEvent.VK_A)
    you'd guess the A key

  7. #7
    Junior Member
    Join Date
    Jul 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I make keybindings?

    Thanks, everybody!

  8. #8
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: How do I make keybindings?

    There's always the Java Tutorials: How To Use Key Bindings.

  9. #9
    Junior Member
    Join Date
    Jul 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How do I make keybindings?

    Key binding shows the action of the command as no confirmation is required. By providing a new key binding for the existing action. Key bindings are also use by mnemonics. Using a key binding is not a simple process.

Similar Threads

  1. need help make a programs...
    By grendar in forum Loops & Control Statements
    Replies: 3
    Last Post: April 13th, 2011, 01:02 PM
  2. How to make a graph like this
    By sugarhigh in forum AWT / Java Swing
    Replies: 1
    Last Post: August 27th, 2010, 09:05 AM
  3. Trying to make a bot
    By ighor10 in forum Java Theory & Questions
    Replies: 1
    Last Post: June 11th, 2010, 02:07 PM
  4. make forum with EJB??!!
    By element_sole in forum Enterprise JavaBeans
    Replies: 3
    Last Post: February 12th, 2010, 02:18 PM
  5. How to make it???
    By Subhasis Banerjee in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: October 29th, 2009, 02:49 PM