本文整理匯總了Java中edu.mit.csail.sdg.alloy4.OurSyntaxWidget.moveCaret方法的典型用法代碼示例。如果您正苦於以下問題:Java OurSyntaxWidget.moveCaret方法的具體用法?Java OurSyntaxWidget.moveCaret怎麽用?Java OurSyntaxWidget.moveCaret使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.mit.csail.sdg.alloy4.OurSyntaxWidget
的用法示例。
在下文中一共展示了OurSyntaxWidget.moveCaret方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doFindNext
import edu.mit.csail.sdg.alloy4.OurSyntaxWidget; //導入方法依賴的package包/類
/** This method performs Edit->FindNext. */
private Runner doFindNext() {
if (wrap) return wrapMe();
if (lastFind.length()==0) return null;
OurSyntaxWidget t = text.get();
String all = t.getText();
int i = Util.indexOf(all, lastFind, t.getCaret()+(lastFindForward?0:-1),lastFindForward,lastFindCaseSensitive);
if (i<0) {
i=Util.indexOf(all, lastFind, lastFindForward?0:(all.length()-1), lastFindForward, lastFindCaseSensitive);
if (i<0) { log.logRed("The specified search string cannot be found."); return null; }
log.logRed("Search wrapped.");
} else {
log.clearError();
}
if (lastFindForward) t.moveCaret(i, i+lastFind.length()); else t.moveCaret(i+lastFind.length(), i);
t.requestFocusInWindow();
return null;
}
示例2: doFindNext
import edu.mit.csail.sdg.alloy4.OurSyntaxWidget; //導入方法依賴的package包/類
/** This method performs Edit->FindNext. */
private Runner doFindNext() {
if (wrap)
return wrapMe();
if (lastFind.length() == 0)
return null;
OurSyntaxWidget t = text.get();
String all = t.getText();
int i = Util.indexOf(all, lastFind, t.getCaret() + (lastFindForward ? 0 : -1), lastFindForward,
lastFindCaseSensitive);
if (i < 0) {
i = Util.indexOf(all, lastFind, lastFindForward ? 0 : (all.length() - 1), lastFindForward,
lastFindCaseSensitive);
if (i < 0) {
log.logRed("The specified search string cannot be found.");
return null;
}
log.logRed("Search wrapped.");
} else {
log.clearError();
}
if (lastFindForward)
t.moveCaret(i, i + lastFind.length());
else
t.moveCaret(i + lastFind.length(), i);
t.requestFocusInWindow();
return null;
}