CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Java Programming > Java Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Java Programming Ask your Java programming question and help out others with theirs.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old November 4th, 2009, 04:26 PM
    rithmoe rithmoe is offline
    Junior Member
     
    Join Date: Nov 2009
    Posts: 3
    rithmoe is an unknown quantity at this point (<10)
    Question Quick question about *very* simple text UI

    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
    Reply With Quote
      #2    
    Old November 5th, 2009, 10:15 AM
    Londbrok Londbrok is offline
    Member
     
    Join Date: Apr 2007
    Posts: 370
    Londbrok is on a distinguished road (10+)
    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.
    Reply With Quote
      #3    
    Old November 5th, 2009, 01:03 PM
    rithmoe rithmoe is offline
    Junior Member
     
    Join Date: Nov 2009
    Posts: 3
    rithmoe is an unknown quantity at this point (<10)
    Smile Re: Quick question about *very* simple text UI

    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.
    Reply With Quote
      #4    
    Old November 7th, 2009, 12:27 PM
    rithmoe rithmoe is offline
    Junior Member
     
    Join Date: Nov 2009
    Posts: 3
    rithmoe is an unknown quantity at this point (<10)
    Angry Re: Quick question about *very* simple text UI

    I gave up on the text UI; apparently there's no cross-platform function to clear the terminal.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Java Programming > Java Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:26 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009