Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void findBack(JTextArea TextArea, String searchText) {
- jTextArea = TextArea;
- text = searchText;
- try
- {
- if (endIndex == 0) endIndex = jTextArea.getText().length();
- int select_end = jTextArea.getText().toLowerCase().indexOf(text.toLowerCase(), endIndex);
- int select_start = select_end > text.length() ? select_end - text.length() : jTextArea.getText().length();
- jTextArea.select(select_start, select_end);
- endIndex = select_end;
- if(select_end == jTextArea.getText().toLowerCase().lastIndexOf(text.toLowerCase()))
- {
- endIndex = text.length();
- }
- }
- catch(NullPointerException e)
- {}
- }
Add Comment
Please, Sign In to add comment