本文整理匯總了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();
}