I don't know why you can't just tell it to selectAll() in the MouseListener without even bothering with another class. But if you must, what I posted should work.
Type: Posts; User: javapenguin
I don't know why you can't just tell it to selectAll() in the MouseListener without even bothering with another class. But if you must, what I posted should work.
Change it to JTextField if you want, though it'll still work as JTextComponent as parameter for the static method. In fact, the way I have it, it'll work with JTextAreas too.
#-o#-o#-o#-o
Now I get what you wanted.
Here's what you should do.
Create a class called AutoSelect that has a static method that takes a textField(or TextArea), whichever you're using , and...
If it's an instance of JTextField, why cast it at all? (Maybe I'm wrong here.)
You're selecting all the text, but it appears you're doing nothing with it.
Anyway, you can set the background...