![](/img/trans.png)
[英]import error while adding TextEditor to eclipse plugin - Cannot find the class file for org.eclipse.jface.text.revisions.RevisionInformation
[英]Find Next in texteditor
我正在嘗試在JTextArea
編寫搜索功能。 我這樣做是為了尋找,但是尋找下一個是我被困住的地方。 在JTextArea
中找到所有單詞之前,不應關閉JOptionPane
。
private void findActionPerformed(java.awt.event.ActionEvent evt) {
findString = JOptionPane.showInputDialog(null, "Find What", "Find", JOptionPane.INFORMATION_MESSAGE);
text = editorTextArea.getText();
index = text.indexOf(findString, 0);
editorTextArea.setCaretPosition(index);
editorTextArea.setSelectionStart(index);
editorTextArea.setSelectionEnd(index + findString.length());
}
使用最后一個查找完成后,請使用非模態JDialog並手動對其進行處理。 有關JDialog的更多詳細信息,請訪問http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.