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

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

  • 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 --

  • 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 --
    :
    :



  • : 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

Sign In or Register to comment.

Howdy, Stranger!

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

Categories