The only way I know of that will achieve something similar, is to use the java.io.Console class added in 1.6.
It provides you with a readPassword() method that disables the local echo when a user enters the password.
Not quite the same thing, I know, but I think that's as close as you're going to get.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.