I want to create a putty like terminal in swing.Now two things are there I'm stuck right now.One the cursor is there I want to make it like ubuntu terminal cursor.A rectangle one.I have found that I need to override damage and paint for that.But I couldn't get much from there.Second is I added a JTextArea in a JFrame which is having the string "[root@localhost]#" but by pressing backspace it is being deleted what I don't want.Please tell me how to acheive these two things.
You will need to change the key bindings of your text component to make enter "execute" the part after the current prompt. When this "execution" is done you print the prompt on a new line. When the part is empty the execution is simply to do nothing.
the string '[root@localhost]#' becomes part of the border, not the textArea.
the description of the component in Darryl's link does seem to be what you're after.
Joined: Jun 15, 2011
Protecting the part "[root@localhost ~]" is done.Now I am unable to navigate and delete the text.I have used Darryl's "ProtectedDocument" class.Thanks Darryl for that.Now again I have two requirements.When I am running my swing application the cursor is at line 1 at r.I have passed -1,10 as "protect's" "start" and "end" parameters respectively.Now I want when I start my app and the frame is drawn the cursor should be at the end of "[root@localhost ~]" that is after ']' character.Second thing is I want to implement a key listener which will listen to 'Enter' key and again redraw "[root@localhost ~]" on the next line.But if some command is passed that will be executed and output will be displayed after that "[root@localhost ~]" will be drawn.