The Find and Replace menu is a useful way to search for specific text in your files, and replace it, if you so choose. To launch the Find/Replace tab, either use the keyboard shortcut Ctrl-F or choose "Edit, Find and Replace" from the menu at the top of the DrJava window. Once you do this, the Find/Replace tab will appear at the bottom of the screen. Type the text you want to search for in the "Find Next" box, and if you want to replace it with anything, type that in the "Replace With" box. Then, chose which of the four options to the right of those text boxes that you want to use, and press one of the buttons at the bottom, or the Enter key. The direction of the search executed by pressing the Enter key depends on the direction of the last search. (The last direction is indicated by the label of the Find box: "Find Next" or "Find Prev").
Match Case: Makes the search becomes case sensitive.
Search All Documents: Causes your search text to be looked for in all open files.
Whole Word: Only finds instances of your search text that are preceeded and followed by either a space, a period, or an open or close parenthesis.
No Comments/String: Ignores any instances found within comments or strings.
Search Selection Only: Only used with Find/Replace All. Allows user to find/replace all instances of a word or phrase within a highlighted portion of the document.
To go from instance to instance of your search text, use the four buttons at the bottom.
Find Next: Finds the next instance. Switches the label of the Find box to "Find Next", indicating the direction of the next search.
Find Previous: Finds the previous instance. Switches the label of the Find box to "Find Prev", indicating the direction of the next search.
Find All: Find all occurrences of the search string. This opens a new "Find: word" pane, where "word" is replaced with the search string. In this pane, view all found instances and jump to their locations in the text. You can have as many "Find All" panes as you like open concurrently. The "Find All" tool also automatically underlines the occurrences. In the screenshot below, the user searched for the word "System":
Replace/Find Next: Replaces the current instance with your replace text and then finds the next instance. Switches the label of the Find box to "Find Next", indicating the direction of the next search
Replace/Find Previous: Replaces the current instance with your replace text and then finds the previous instance. Switches the label of the Find box to "Find Previous", indicating the direction of the next search
Replace: Replaces the current instance with your replace text.
Replace All: Replaces all instances of the search text with the replace text automatically
A relatively new feature of Find and Replace is the ability to search across more than one line of text. The Find and Replace text boxes can accept more than one line of text. To use this feature you have two options. First, you can copy/paste directly into the Find and Replace boxes and search/replace as normal. Second, you can type text directly into the boxes, and when you want to create a new line press Ctrl-Enter (Note: Pressing only the Enter key when inside the Find box executes a Find. It DOES NOT create a new line. Both Enter and Ctrl-Enter create a new line inside the Replace box).