2012-03-04 3 views
0

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()); 
}  
+1

에서 확인하십시오. [SSCCE] (http://sscce.org/), – mKorbel

+1

"으로 질문을 편집하십시오. * 모든 단어가 다음과 같이 나타날 때까지 'JOptionPane'이 닫히지 않아야합니다. 'JTextArea'에서 찾을 수 있습니다. * 검색은 옵션 창이 닫힐 때까지 ***을 시작하지 않으므로 실용적이지는 않습니다. –

답변

관련 문제