| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Java Programming Ask your Java programming question and help out others with theirs. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello folks,
I want to build a simple "check box style" selector that is a row of six words, and some kind of cursor (angle brackets around the word, perhaps), that moves with the left/right arrow keys. The space bar will toggle the selected word to be highlighted or un-highlighted. And the enter key makes the selection. Google has not produced any tutorials on this subject. Obviously I could make this a GUI in a few minutes but that's not what I'm after. I want to keep it in the console. How do I do this properly? Thank you. -rithmoe |
|
#2
|
|||
|
|||
|
Re: Quick question about *very* simple text UI
Write a widget that listens to System.in, respond to the keys you choose, eg. left and right arrow. Write the next resulting text with the right word bracketed to the System.out. Not sure, but you may be able to clear the console with System.out.flush()
The widget could be made using eg. Scanner. Widget would have a "selection method", in which it loops the possible options with arrow keys, untill enter is pressed. Method returns the last selected option. You could use enums as options, simplifies a lot. Last edited by Londbrok; November 5th, 2009 at 10:18 AM. |
|
#3
|
|||
|
|||
|
Thanks for the pointers, especially widgets! I am fairly experienced with Java but did not about these guys. Terrible name, though, was that Sun's decision?
Bonus is finally learning what SWT stands for. |
|
#4
|
|||
|
|||
|
I gave up on the text UI; apparently there's no cross-platform function to clear the terminal.
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|