This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JEditorPane html getCaretPosition

 
John Carver
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to make an simple HTML editor and I'm having a problem with determining if the text is bold at the caret posistion in a JEditorPane. Is there an easy way of determining this?
 
Pat Hays
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

Try the following code.
-------------------
jEditorPane1.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
jEditorPane1_caretUpdate(e);
}

});
...
...
private void jEditorPane1_caretUpdate(CaretEvent e)
{
System.out.println("\njEditorPane1_caretUpdate(CaretEvent e) called.");
System.out.println(">>" + "location:" + e.getDot() + ";\tthe location of other end of the logical selection:" + e.getMark());
// TODO: Add any handling code here

}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic