Advice for a REPL GUI
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.
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.
Thank you Fubarable and DarrylBurke, the DocumentFilters look to be exactly what I need. :(nod):