• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to take and check input in Java

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Respected Members,
I have 3 questions with slight changes, I would be thankful to you if you can help me solve this problem, I consulted some books and web sites but did not found the solution, the questions are as follows:

1) I want to make a Java console program which when executed will ask the user to enter some input from the key board on the command prompt,now suppose if the user enters Ctrl-F3 than a message would be printed that "you have entered the correct input", but if the user enters any other key or a combination of various key a message will be printed "you did not entered the correct key". Now my question is that how will I take input and after that on what basis will I cehck that a combination of paticular keys(Ctrl-F3) is pressed, I mean that what will be the basis of the IF ceck and what is the thing which I am going to check? If any one cal mail some sample code for this program I would really be thankful, or if you can give some oter important resources?

2) Now my second question is just an extension fo the first question with some slight variations.The thing which I was doing in previous question on a console based program I will now have to do it in GUI based program, I mean that now when I run my program a form(frame a JFrame or Frame) it will ask the user to enter some input from the key baord again if the user presses Ctrl-F3 than a message will be displayed taht you have entered correct input for any other key or key combinations tahnsome other message will be displayed, now here also my question is the same tat how will I take input,than how will I check this input and on what basis will I identify Ctrl-F3 key press.

3) The third question is same as the first two questions,but here my Java program is running like a Windows process I mean that when ever I start my computer this program starts nning at the back end in Windows(Win XP OS),and the program is continiously tracking all the key presses by the users if some user enters Ctrl-F3 a message will be displayed and if the user enters any other key or combination of keys than nothing will happen,how can I achive this and again I am asking that on what basis will I check the suer input,what will be the IF check,and how can I take input.

Please all reply soon because I consulted some books and web sites but did not found the solution,please guide me,I would be thankful to all of you people.

Thanking You,
Bilal Ali.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(2) is pretty easy; just look at the Swing tutorials on Sun's web site to learn how.

The other two simply can't be done using Java alone. You can only do them using Java plus native code (platform-specific code written in a language like C.)
 
This is my favorite show. And this is my favorite tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic