I need to populate JPassword field. However it looks like there is no method setPassword (char [])
The only method for this is to setText . However I will need to feed a String
Since getText is deprecated , so I presume setText will also be deprecated.
Here is an extract from an answer on stackoverflow
When calling getText you get a String (immutable object) that may not be changed (except reflection) and so the password stays in the memory until garbage collected
So does the same thing happen when I setText . I feed a String and it stays in memory. Why isn't setText deprecated? Why isn't there a setPassword (char []) method ?