当前位置: 首页>>代码示例>>Java>>正文


Java AccessibleText.getIndexAtPoint方法代码示例

本文整理汇总了Java中javax.accessibility.AccessibleText.getIndexAtPoint方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibleText.getIndexAtPoint方法的具体用法?Java AccessibleText.getIndexAtPoint怎么用?Java AccessibleText.getIndexAtPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.accessibility.AccessibleText的用法示例。


在下文中一共展示了AccessibleText.getIndexAtPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseClicked

import javax.accessibility.AccessibleText; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    Point point = e.getPoint();
    AccessibleText at = (AccessibleText) label.getAccessibleContext();
    int pos = at.getIndexAtPoint(point);
    AttributeSet as = at.getCharacterAttribute(pos);
    if (label.isEnabled() && as.getAttribute(HTML.Tag.A) != null) {
        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        SimpleAttributeSet attr=(SimpleAttributeSet)as.getAttribute(HTML.Tag.A);
        String href=(String)attr.getAttribute(HTML.Attribute.HREF);
        fireActionPerformed(
        new ActionEvent(label,ActionEvent.ACTION_PERFORMED,href));
    } else {
        label.setCursor(Cursor.getDefaultCursor());
    }
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:17,代码来源:JLabelHyperlinkHandler.java

示例2: mouseMoved

import javax.accessibility.AccessibleText; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
    Point point = e.getPoint();
    AccessibleText at = (AccessibleText) label.getAccessibleContext();
    int pos = at.getIndexAtPoint(point);
    AttributeSet as = at.getCharacterAttribute(pos);
    if (label.isEnabled() && as.getAttribute(HTML.Tag.A) != null) {
        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        label.setCursor(Cursor.getDefaultCursor());
    }
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:13,代码来源:JLabelHyperlinkHandler.java

示例3: getIndexAtPoint

import javax.accessibility.AccessibleText; //导入方法依赖的package包/类
/**
 * Given a point in local coordinates, return the zero-based index of
 * the character under that Point. If the point is invalid, this method
 * returns -1.
 * 
 * @param p
 *        the Point in local coordinates
 * @return the zero-based index of the character under Point p; if Point
 *         is invalid return -1.
 */
public int getIndexAtPoint(Point p) {
	AccessibleText at = getNoteLabelAccessibleText();
	if (at != null && sameWindowAncestor(pane, noteLabel)) {
		// convert point from the option pane bounds
		// to the note label bounds.
		Point noteLabelPoint = SwingUtilities.convertPoint(pane, p, noteLabel);
		if (noteLabelPoint != null) {
			return at.getIndexAtPoint(noteLabelPoint);
		}
	}
	return -1;
}
 
开发者ID:tobiasschulz,项目名称:voipcall,代码行数:23,代码来源:ProgressMonitor.java


注:本文中的javax.accessibility.AccessibleText.getIndexAtPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。