hello everbody,
i'm bignner in java dev, i need a java application that when i press a key mainly F1,F2 .... return the keycode without using swing just by console.
thank you very much
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.
hello everbody,
i'm bignner in java dev, i need a java application that when i press a key mainly F1,F2 .... return the keycode without using swing just by console.
thank you very much
Welcome blacksadangel
Post what you have done/tried so far and explain a little about where you are stuck or ask some questions that would get you back on track.
Alternatively you can search with keywords like "Java keyboard listener" and most likely find something useful
It's not possible in pure Java. You'll need to use some native code to accomplish this. For example, Here's a post I made on how to accomplish this on Windows.
Alternatively, you can use the Java Native Access (JNA) library which has a utility which allows you to check the key state "on-demand".
thank you for yours response
for example when i press f1,the application show message "f1 pressed" i find a java swing that work fine,but for my case i want just worked in console.
thank you