hmmm, I don't know how they implement it, but I know IntelliJ IDEA has a code highlighting feature that does just what you're asking:
IntelliJ IDEA's On-the-Fly Code Analysis Highlighting unused imports, throws declarations and other unused symbols IDEA will point out all redundant import statements, throws declarations and other unused symbols (like variables and methods), and will highlight them in the editor with the corresponding links on the right gutter area for easier navigation. More information on other code analysis features can be found here.
Eclipse can also find unread/unused local variables, though I don't think its code analysis is in the same league as IDEA. In 3.0, go Window->Preferences->Java->Compiler to see the options you have. Cheers,
What is the difference between 'remove' and 'remove completly'? In particular when it is unused? Do you want to remove them from a compiled class or from source-code? Are you looking for something like: