Tabnine Logo
JLabel$AccessibleJLabel.getCharacterAttribute
Code IndexAdd Tabnine to your IDE (free)

How to use
getCharacterAttribute
method
in
javax.swing.JLabel$AccessibleJLabel

Best Java code snippets using javax.swing.JLabel$AccessibleJLabel.getCharacterAttribute (Showing top 4 results out of 315)

origin: net.java.dev.jets3t/jets3t

/**
 * Changes the mouse cursor to a hand to indicate when the mouse moves over a clickable
 * HTML link.
 *
 * @param e event
 */
public void mouseMoved(MouseEvent e) {
  AccessibleJLabel acc = (AccessibleJLabel) getAccessibleContext();
  int stringIndexAtPoint = acc.getIndexAtPoint(e.getPoint());
  if (stringIndexAtPoint < 0) {
    return;
  }
  javax.swing.text.AttributeSet attr = acc.getCharacterAttribute(stringIndexAtPoint);
  if (attr.getAttribute(HTML.Tag.A) == null) {
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  } else {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Changes the mouse cursor to a hand to indicate when the mouse moves over a clickable
 * HTML link.
 *
 * @param e event
 */
public void mouseMoved(MouseEvent e) {
  AccessibleJLabel acc = (AccessibleJLabel) getAccessibleContext();
  int stringIndexAtPoint = acc.getIndexAtPoint(e.getPoint());
  if (stringIndexAtPoint < 0) {
    return;
  }
  javax.swing.text.AttributeSet attr = acc.getCharacterAttribute(stringIndexAtPoint);
  if (attr.getAttribute(HTML.Tag.A) == null) {
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  } else {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  }
}
origin: net.java.dev.jets3t/jets3t

/**
 * Triggers the listener to follow an HTML href link that has been clicked.
 *
 * @param e event
 */
public void mouseClicked(MouseEvent e) {
  AccessibleJLabel acc = (AccessibleJLabel) getAccessibleContext();
  int stringIndexAtPoint = acc.getIndexAtPoint(e.getPoint());
  if (stringIndexAtPoint < 0) {
    return;
  }
  AttributeSet attr = (AttributeSet) acc.getCharacterAttribute(
    acc.getIndexAtPoint(e.getPoint())).getAttribute(HTML.Tag.A);
  if (attr != null) {
    String href = (String) attr.getAttribute(HTML.Attribute.HREF);
    String target = (String) attr.getAttribute(HTML.Attribute.TARGET);
    try {
      if (listener == null) {
        log.warn("No HyperlinkActivatedListener available to follow HTML link for label: "
          + getText());
      } else {
        listener.followHyperlink(new URL(href), target);
      }
    } catch (Exception ex) {
      log.error("Unable to load URL: " + href, ex);
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Triggers the listener to follow an HTML href link that has been clicked.
 *
 * @param e event
 */
public void mouseClicked(MouseEvent e) {
  AccessibleJLabel acc = (AccessibleJLabel) getAccessibleContext();
  int stringIndexAtPoint = acc.getIndexAtPoint(e.getPoint());
  if (stringIndexAtPoint < 0) {
    return;
  }
  AttributeSet attr = (AttributeSet) acc.getCharacterAttribute(
    acc.getIndexAtPoint(e.getPoint())).getAttribute(HTML.Tag.A);
  if (attr != null) {
    String href = (String) attr.getAttribute(HTML.Attribute.HREF);
    String target = (String) attr.getAttribute(HTML.Attribute.TARGET);
    try {
      if (listener == null) {
        log.warn("No HyperlinkActivatedListener available to follow HTML link for label: "
          + getText());
      } else {
        listener.followHyperlink(new URL(href), target);
      }
    } catch (Exception ex) {
      log.error("Unable to load URL: " + href, ex);
    }
  }
}
javax.swingJLabel$AccessibleJLabelgetCharacterAttribute

Popular methods of JLabel$AccessibleJLabel

  • getIndexAtPoint
  • getAccessibleName
  • getAccessibleText

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • Kernel (java.awt.image)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • ImageIO (javax.imageio)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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