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

How to use
JLabel$AccessibleJLabel
in
javax.swing

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

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);
    }
  }
}
origin: com.jgoodies/jgoodiesforms

/**
 * Returns the accessible name of this label.
 * Unlike the superclass behavior, this implementation
 * cuts off a trailing colon (':') - if any.
 *
 * @return the label name
 *
 * @see AccessibleContext#setAccessibleName
 */
@Override
public String getAccessibleName() {
  if (accessibleName != null) {
    return accessibleName;
  }
  String text = FormsLabel.this.getText();
  if (text == null) {
    return super.getAccessibleName();
  }
  return text.endsWith(":")
    ? text.substring(0, text.length()-1)
    : text;
}
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

/**
 * 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

/**
 * 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: raydac/netbeans-mmd-plugin

 @Nullable
 private String getLinkAtPosition(@Nonnull final Point point) {
  if (this.linkCache == null) {
   cacheLinkElements();
  }

  final AccessibleJLabel accessibleJLabel = (AccessibleJLabel) this.getAccessibleContext().getAccessibleComponent();
  final int textIndex = accessibleJLabel.getIndexAtPoint(point);
  for (final HtmlLinkAddress l : this.linkCache) {
   if (l.checkPosition(textIndex)) {
    return l.getHREF();
   }
  }
  return null;
 }
}
origin: kaikramer/keystore-explorer

protected String getLink(Point p) {
  final AccessibleContext aC = getAccessibleContext();
  if (aC instanceof AccessibleJLabel) {
    final AccessibleJLabel aL = (AccessibleJLabel) aC;
    final AccessibleText aT = aL.getAccessibleText();
    if (aT == null) {
      return null;
    }
    final int index = aL.getIndexAtPoint(p);
    for (final LinkDescriptor entry : listLinks) {
      if (index >= entry.getStart() && index <= entry.getEnd()) {
        return entry.getUrl();
      }
    }
  }
  return null;
}
javax.swingJLabel$AccessibleJLabel

Most used methods

  • getIndexAtPoint
  • getCharacterAttribute
  • getAccessibleName
  • getAccessibleText

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JFrame (javax.swing)
  • Top Sublime Text 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