congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DefaultStyledDocument.getCharacterElement
Code IndexAdd Tabnine to your IDE (free)

How to use
getCharacterElement
method
in
javax.swing.text.DefaultStyledDocument

Best Java code snippets using javax.swing.text.DefaultStyledDocument.getCharacterElement (Showing top 12 results out of 315)

origin: net.sf.squirrel-sql/squirrel-sql

public void mouseClicked(MouseEvent ev) {
  JTextPane editor = (JTextPane) ev.getSource();
   editor.setEditable(false);
   Point pt = new Point(ev.getX(), ev.getY());
   int pos = editor.viewToModel(pt);
   if (pos >= 0) {
    Document eDoc = editor.getDocument();
    if (eDoc instanceof DefaultStyledDocument) {
     DefaultStyledDocument hdoc =
      (DefaultStyledDocument) eDoc;
     Element e = hdoc.getCharacterElement(pos);
     AttributeSet a = e.getAttributes();
     AttributeSet tagA = (AttributeSet) a.getAttribute(HTML.Tag.A);
     String href = null;
     if (tagA!=null){
       href = (String)tagA.getAttribute(HTML.Attribute.HREF);
     }
     if (href != null) {
      Desktop desktop = Desktop.getDesktop();
      try {
        desktop.browse(new URI(href));
      } catch (IOException e1) {
         s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
      } catch (URISyntaxException e1) {
         s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
      }
    }
   }
  }
}
origin: realXuJiang/bigtable-sql

public void mouseClicked(MouseEvent ev) {
  JTextPane editor = (JTextPane) ev.getSource();
   editor.setEditable(false);
   Point pt = new Point(ev.getX(), ev.getY());
   int pos = editor.viewToModel(pt);
   if (pos >= 0) {
    Document eDoc = editor.getDocument();
    if (eDoc instanceof DefaultStyledDocument) {
     DefaultStyledDocument hdoc =
      (DefaultStyledDocument) eDoc;
     Element e = hdoc.getCharacterElement(pos);
     AttributeSet a = e.getAttributes();
     AttributeSet tagA = (AttributeSet) a.getAttribute(HTML.Tag.A);
     String href = null;
     if (tagA!=null){
       href = (String)tagA.getAttribute(HTML.Attribute.HREF);
     }
     if (href != null) {
      Desktop desktop = Desktop.getDesktop();
      try {
        desktop.browse(new URI(href));
      } catch (IOException e1) {
         s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
      } catch (URISyntaxException e1) {
         s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
      }
    }
   }
  }
}
origin: stackoverflow.com

final Element el = doc.getCharacterElement(i);
final AttributeSet a = el.getAttributes();
final AttributeSet anchor = (AttributeSet)a.getAttribute(HTML.Tag.A);
origin: stackoverflow.com

field.setSelectionStart(doc.getCharacterElement(field.getCaretPosition()).getParentElement().getStartOffset());
field.setSelectionEnd(doc.getCharacterElement(field.getCaretPosition()).getParentElement().getEndOffset());
origin: stackoverflow.com

if (pos >= 0 && editor.getDocument() instanceof HTMLDocument) {
  HTMLDocument hdoc = (HTMLDocument) editor.getDocument();
  Element elem = hdoc.getCharacterElement(pos);
  if (elem.getAttributes().getAttribute(HTML.Tag.A) != null) {
    return elem;
origin: realXuJiang/bigtable-sql

DefaultStyledDocument hdoc =
 (DefaultStyledDocument) eDoc;
Element e = hdoc.getCharacterElement(pos);
AttributeSet a = e.getAttributes();
AttributeSet tagA = (AttributeSet) a.getAttribute(HTML.Tag.A);
origin: net.sf.squirrel-sql/squirrel-sql

DefaultStyledDocument hdoc =
 (DefaultStyledDocument) eDoc;
Element e = hdoc.getCharacterElement(pos);
AttributeSet a = e.getAttributes();
AttributeSet tagA = (AttributeSet) a.getAttribute(HTML.Tag.A);
origin: stackoverflow.com

Element leaf = doc.getCharacterElement( branch.getStartOffset() );
AttributeSet as = leaf.getAttributes();
origin: stackoverflow.com

if (pos >= 0 && doc instanceof HTMLDocument) {
  HTMLDocument hdoc = (HTMLDocument) doc;
  Element elem = hdoc.getCharacterElement(pos);
  if (elem.getAttributes().getAttribute(HTML.Tag.A) != null) {
    return elem;
origin: stackoverflow.com

if (pos >= 0 && editor.getDocument() instanceof HTMLDocument) {
  HTMLDocument hdoc = (HTMLDocument) editor.getDocument();
  Element elem = hdoc.getCharacterElement(pos);
  if (elem.getAttributes().getAttribute(HTML.Tag.A) != null) {
    return elem;
origin: Waikato/weka-trunk

Element leaf = m_Self.getCharacterElement(branch.getStartOffset());
AttributeSet as = leaf.getAttributes();
origin: nz.ac.waikato.cms.weka/weka-stable

Element leaf = m_Self.getCharacterElement(branch.getStartOffset());
AttributeSet as = leaf.getAttributes();
javax.swing.textDefaultStyledDocumentgetCharacterElement

Popular methods of DefaultStyledDocument

  • <init>
  • getLength
  • insertString
  • getText
  • remove
  • setCharacterAttributes
  • addDocumentListener
  • setDocumentFilter
  • addUndoableEditListener
  • createPosition
  • getParagraphElement
  • setParagraphAttributes
  • getParagraphElement,
  • setParagraphAttributes,
  • getDefaultRootElement,
  • insert,
  • addStyle,
  • fireInsertUpdate,
  • fireRemoveUpdate,
  • getEndPosition,
  • getStyle

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getResourceAsStream (ClassLoader)
  • Menu (java.awt)
  • String (java.lang)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now