Inserting text in JTextArea

i am developing a simple application in Java and i wanted to know if there is any way i can insert additional text(somewhere in the middle of a sentence) inside a textarea , which is not empty, at a position where the cursor is placed on the click of some component. Can someone please direct me how to go about getting it done

Answers


If this is a JTextArea component you can use the .append method to add text to the end of the text area, or the .insert method to insert the new text at a specific position.

If you need to insert the text at the current cursor position use the (not-so-obviously-named) .getCaretPosition method


Need Your Help

VNC to MAC but MAC is sleeping

osx vnc vnc-viewer

I assume my my MAC is sleeping if I try and connect with VNC is hangs. If I happen to be at the MAC console I can move the mouse or keyboard and then the VNC works. Is there a way to trigger a wak...

How to make version compatible of a pdf file through itextsharp in c#.net

c# asp.net pdf download itextsharp

I want to create a downlodable pdf file through itextsharp dll (ver 5.0.5). I have four textboxes which is filled by the user and click on download pdf file. Filled text paste in specific location in

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.