Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:39:11+00:00 2026-05-30T22:39:11+00:00

I have a question about a KeyListener . When I get the KeyEvent and

  • 0

I have a question about a KeyListener.
When I get the KeyEvent and do a getKeyChar() I’m tyring to compare to and * asterisk and I was going to use one of the KeyEvent.VK_ defines which works for a lot of the keys.

But for this particular key and some others the values don’t match up.

The * getKeyChar() will return 0x2a and the getKeyCode() returns 0x38. The define for 0x38 is VK_8 not VK_ASTERISK which is 0x97.

Why do certain keycodes match up and not others. Most do thouh. If I just do a character compare that works( == '*'), but I’m not sure if this the best solution?

Thank you for all help!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:39:12+00:00Added an answer on May 30, 2026 at 10:39 pm

    OK, you’re misunderstanding something.

    Keys are keys, and symbols are symbols. Symbols are results of key presses, and the same key can result in different symbols depending on circumstances (key combinations like Alt, Control, Shift etc).

    So, VK_8 key code stands for the key that can produce symbols 8, * and possibly others depending on keyboard localization.

    And the * dedicated key on numeric keyboard is VK_MULTIPLY – it can produce just one symbol * (to my knowledge).

    You probably shouldn’t care about the key that the user pressed, but about the symbol that this user action produced.

    This info you can get with getKeyChar(), but please note that if the user presses Shift 8 combination to produce * it’s actually two keys (Shift and 8) and you will get two events, and the first one (for Shift) will produce an unreadable symbol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have question about why should we use return in get,if dont use what
I have a question about best practices regarding how one should approach storing complex
I have question regarding about finding subview using '.tags' in one UIView. for (UIView
I'm learning asp.net. I have question about example buttons I can use two types
Today I have question about Eclipse . I use this IDE very long and
I have a question about: how can I use foreach the service's namespaces in
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question about normalization. Suppose I have an applications dealing with songs. First
I have a question about using streams in .NET to load files from disk.
I have a question about locking. This doesn't have to be only about record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.