本文整理汇总了Java中javax.swing.text.Segment.next方法的典型用法代码示例。如果您正苦于以下问题:Java Segment.next方法的具体用法?Java Segment.next怎么用?Java Segment.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.Segment
的用法示例。
在下文中一共展示了Segment.next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNextWordStart
import javax.swing.text.Segment; //导入方法依赖的package包/类
/** This helper method will return the start character of the next
* word in the buffer from the start position
*/
private static int getNextWordStart(Segment text, int startPos) {
if (startPos <= text.getEndIndex())
for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
if (Character.isLetterOrDigit(ch)) {
return text.getIndex();
}
}
return -1;
}
示例2: getNextWordEnd
import javax.swing.text.Segment; //导入方法依赖的package包/类
/** This helper method will return the end of the next word in the buffer.
*
*/
private static int getNextWordEnd(Segment text, int startPos) {
for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
if (!Character.isLetterOrDigit(ch)) {
if (ch == '-' || ch == '\'') { // handle ' and - inside words
char ch2 = text.next();
text.previous();
if (ch2 != Segment.DONE && Character.isLetterOrDigit(ch2))
continue;
}
return text.getIndex();
}
}
return text.getEndIndex();
}
示例3: getNextWordStart
import javax.swing.text.Segment; //导入方法依赖的package包/类
/**
* This helper method will return the start character of the next
* word in the buffer from the start position
*
* @param text Description of the Parameter
* @param startPos Description of the Parameter
* @return The nextWordStart value
*/
private static int getNextWordStart(Segment text, int startPos) {
if (startPos <= text.getEndIndex())
for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
// changed by Saruta
if (Character.isLetterOrDigit(ch) || ch == '-' || ch == '\'' || ch == '~') {
return text.getIndex();
}
}
return -1;
}
示例4: getNextWordEnd
import javax.swing.text.Segment; //导入方法依赖的package包/类
/**
* This helper method will return the end of the next word in the buffer.
*
* @param text Description of the Parameter
* @param startPos Description of the Parameter
* @return The nextWordEnd value
*/
private static int getNextWordEnd(Segment text, int startPos) {
for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
if (!Character.isLetterOrDigit(ch)) {
// changed by Saruta
if (ch == '-' || ch == '\'' || ch == '~') {
// handle ' and - inside words
continue;
}
return text.getIndex();
}
}
return text.getEndIndex();
}