Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Is there a way to simulate the look of a (Linux) shell program

HGeneAnthonyHGeneAnthony Member Posts: 92
I'm working on a program that teaches users Linux commands. I want to simmulate the shell prompt look and feel but actions won't have any consequences. It'll be like a hands on tutorial. Any help?

Comments

  • KyonKyon Member Posts: 113
    Hi.

    If you're building your prog using Swing or AWT you could use a simple JTextArea or similar to simulate a console. If you're bound to a console window (you're programming this text-based), then you could display a prompt and read in the commands as it would look like on a 'real' console.

    Cheers,
    Kyon

    -- planning is the substitution of hazard by error --

  • HGeneAnthonyHGeneAnthony Member Posts: 92
    Thanx for your reply but I'd like to be able to simulate the shell prompt as much as possible. I plan on using a JTextArea but there's things I need to do to format it so it'll act similar. One thing I really would like to know, and I don't know if it's possible with java, are you able to find out what row and column the cursor is in in a text box and control thing due to it. Ex. If the user is in row 5 and they pushed the up or down arrows can I write some code that will auto them back to 5. To simulate the fact you can't go up or down in script. Also I'd like to be able to place code in script as the user goes on (place opening tags and such)?


    : Hi.
    :
    : If you're building your prog using Swing or AWT you could use a simple JTextArea or similar to simulate a console. If you're bound to a console window (you're programming this text-based), then you could display a prompt and read in the commands as it would look like on a 'real' console.
    :
    : Cheers,
    : Kyon
    :
    : -- planning is the substitution of hazard by error --
    :
    :



  • chamsterchamster Member Posts: 662
    : are you able to find out what row and column the cursor is in

    Yes. It's getCursor or something like that.

    : some code that will auto them back to...

    That would be setCursor or setCursorPosition - check the API for details. The answer is yes.


    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    chamster@home.se
    http://konrads.webbsida.com

  • Shawn CarterShawn Carter Member Posts: 0

    ________ { http://forcoder.org } free video tutorials and ebooks about / Java PL/SQL MATLAB Perl Objective-C Visual Basic C C++ R C# Go Visual Basic .NET Delphi PHP Ruby Assembly Swift Scratch JavaScript Python Erlang FoxPro Lua VBScript ML SAS F# Bash Fortran Logo Clojure Transact-SQL Scheme Awk ABAP COBOL Hack Prolog Ada D Julia LabVIEW Apex Dart Kotlin Scala Crystal Rust Lisp Alice / ______

Sign In or Register to comment.