AquaSpinnerUI.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:jdk8u-dev-jdk 作者:
/**
 * Selects the passed in field, returning true if it is found,
 * false otherwise.
 */
private boolean select(final JFormattedTextField ftf, final AttributedCharacterIterator iterator, final DateFormat.Field field) {
    final int max = ftf.getDocument().getLength();

    iterator.first();
    do {
        final Map<Attribute,Object> attrs = iterator.getAttributes();
        if (attrs == null || !attrs.containsKey(field)) continue;

        final int start = iterator.getRunStart(field);
        final int end = iterator.getRunLimit(field);
        if (start != -1 && end != -1 && start <= max && end <= max) {
            ftf.select(start, end);
        }

        return true;
    } while (iterator.next() != CharacterIterator.DONE);
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号