aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Determining whether object at current caret position is plain text or a component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Determining whether object at current caret position is plain text or a component" Watch "Determining whether object at current caret position is plain text or a component" New topic
Author

Determining whether object at current caret position is plain text or a component

Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
How does one determine whether there is regular text or a component at the current caret position in a JTextPane? For instance..
JTextPane textInput = new JTextPane();
.
.
for(int i = 0; i < textInput.getText().length(); i++){
textInput.setCaretPosition(i);
//check to see whether the current caret position contains
//regular text (content) or if it contains a component.
}


Richard Robbins is one of the founders of WebsiteTemplateDatabase.com, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Determining whether object at current caret position is plain text or a component