Results 1 to 4 of 4
  1. #1
    eulyix is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default Advice for a REPL GUI

    Hello,

    I'm struggling to figure out what the recommended way of making a "prompt" in a shell/REPL would be. To clarify, I'm making an "interpreter loop", think of the UNIX shell.

    I don't want the user to be able to edit the prompt, but I want to be able to update it throughout the users session. That seems to rule out JLabels, and I don't like the idea of a button for this. I'm very new to Swing, but another idea I had was to make a separate text area on the left of the screen that was uneditable, separating it from the underlying process, but that seems too kludgey. What would you suggest?

    Thanks for reading.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    If I understand you correctly, you want to display what appears to be UNIX shell in a JTextArea where the user can enter text into the last line, but cannot erase the prompt that's at the beginning of the last line (and every line that prompts for user input). If so, perhaps you want to add a DocumentFilter to the JTextArea's document to prevent deletions of this region. Myself, I'd display the completed lines in a non-editable JTextArea but prompt the user for input in a JTextField that was below the JTextArea.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

  4. #4
    eulyix is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default

    Thank you Fubarable and DarrylBurke, the DocumentFilters look to be exactly what I need.

Similar Threads

  1. I need your advice
    By mau007 in forum New To Java
    Replies: 4
    Last Post: 04-28-2011, 10:57 PM
  2. looking for OO advice
    By intrepid604 in forum New To Java
    Replies: 7
    Last Post: 02-16-2011, 05:01 PM
  3. need for some advice
    By kasiopi in forum AWT / Swing
    Replies: 3
    Last Post: 01-26-2011, 12:36 PM
  4. Im new n looking for an advice
    By azlynn in forum New To Java
    Replies: 2
    Last Post: 12-10-2009, 02:47 AM
  5. Some advice please!
    By awebbtt in forum New To Java
    Replies: 3
    Last Post: 02-02-2009, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •