本文整理了Java中javax.swing.text.Segment.getEndIndex()
方法的一些代码示例,展示了Segment.getEndIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Segment.getEndIndex()
方法的具体详情如下:
包路径:javax.swing.text.Segment
类名称:Segment
方法名:getEndIndex
暂无
代码示例来源:origin: groovy/groovy-core
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Removes any spaces or tabs from the end of the segment.
*
* @param segment The segment from which to remove tailing whitespace.
* @return <code>segment</code> with trailing whitespace removed.
*/
private static Segment removeEndingWhitespace(Segment segment) {
int toTrim = 0;
char currentChar = segment.setIndex(segment.getEndIndex()-1);
while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
toTrim++;
currentChar = segment.previous();
}
String stringVal = segment.toString();
String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
offs++;
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: org.codehaus.groovy/groovy-console
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: org.kohsuke.droovy/groovy
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: net.sf.jazzy/jazzy
/** 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;
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
/**
* Removes any spaces or tabs from the end of the segment.
*
* @param segment The segment from which to remove tailing whitespace.
* @return <code>segment</code> with trailing whitespace removed.
*/
private static Segment removeEndingWhitespace(Segment segment) {
int toTrim = 0;
char currentChar = segment.setIndex(segment.getEndIndex()-1);
while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
toTrim++;
currentChar = segment.previous();
}
String stringVal = segment.toString();
String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
int start = pos;
boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();
int end = backwards ? 0 : SEGMENT.getEndIndex();
pos += backwards ? -1 : 1;
pos = backwards ? SEGMENT.getEndIndex() : 0;
end = start;
wrapped = false;
代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea
/**
* Removes any spaces or tabs from the end of the segment.
*
* @param segment The segment from which to remove tailing whitespace.
* @return <code>segment</code> with trailing whitespace removed.
*/
private static Segment removeEndingWhitespace(Segment segment) {
int toTrim = 0;
char currentChar = segment.setIndex(segment.getEndIndex()-1);
while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
toTrim++;
currentChar = segment.previous();
}
String stringVal = segment.toString();
String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-editor
/**
* Removes any spaces or tabs from the end of the segment.
*
* @param segment The segment from which to remove tailing whitespace.
* @return <code>segment</code> with trailing whitespace removed.
*/
private static Segment removeEndingWhitespace(Segment segment) {
int toTrim = 0;
char currentChar = segment.setIndex(segment.getEndIndex()-1);
while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
toTrim++;
currentChar = segment.previous();
}
String stringVal = segment.toString();
String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}
代码示例来源:origin: net.sf.jazzy/jazzy
/** 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();
}
代码示例来源:origin: net.sf.jazzy/jazzy
/**
* Sets the current word position at the start of the word containing
* the char at position pos. This way a call to nextWord() will return
* this word.
*
* @param pos position in the word we want to set as current.
*/
public void posStartFullWordFrom(int pos){
currentWordPos=text.getBeginIndex();
if(pos>text.getEndIndex())
pos=text.getEndIndex();
for (char ch = text.setIndex(pos); ch != Segment.DONE; ch = text.previous()) {
if (!Character.isLetterOrDigit(ch)) {
if (ch == '-' || ch == '\'') { // handle ' and - inside words
char ch2 = text.previous();
text.next();
if (ch2 != Segment.DONE && Character.isLetterOrDigit(ch2))
continue;
}
currentWordPos=text.getIndex()+1;
break;
}
}
//System.out.println("CurPos:"+currentWordPos);
if(currentWordPos==0)
first=true;
moreTokens=true;
currentWordEnd = getNextWordEnd(text, currentWordPos);
nextWordPos = getNextWordStart(text, currentWordEnd + 1);
}
代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea
offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
offs++;
代码示例来源:origin: omegat-org/omegat
doc.getText(offs, nleft, seg);
int i = seg.getBeginIndex();
while ((i = defaultFont.canDisplayUpTo(seg, i, seg.getEndIndex())) != -1) {
int cp = Character.codePointAt(seg, i - seg.getBeginIndex());
int start = i;
for (int cpn, ccn, j = i; j < seg.getEndIndex(); j += ccn) {
cpn = Character.codePointAt(seg, j - seg.getBeginIndex());
ccn = Character.charCount(cpn);
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
offs++;
内容来源于网络,如有侵权,请联系作者删除!