how can I add a string to jTextPane at cursor position? Advanced Thanks...

One of the way is

String text = jTextPane1.getText();
text = text.substring(0,jTextPane1.getCaretPosition())+" "+ jTextField1.getText() + " " +text.substring(jTextPane1.getCaretPosition());
jTextPane1.setText(text);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.