> public void mousePressed(MouseEvent e){
> if (e.getSource() instanceof JLabel){
[quoted text clipped - 8 lines]
> (labelFor.getLabelFor()).requestFocus();
> (( WHAT TO WRITE HERE? ) labelFor.getLabelFor() ).selectAll();
WHAT TO WRITE HERE? = JTextComponent
but make sure only JTextComponents are registered with the listener, or have
another if(component instanceof JTextComponent)

Signature
Mike W
Marek Mänd - 17 Dec 2003 14:17 GMT
> "Marek Mänd"
>>public void mousePressed(MouseEvent e){
[quoted text clipped - 12 lines]
> but make sure only JTextComponents are registered with the listener, or have
> another if(component instanceof JTextComponent)
Thank you for answering!
I have located the error and fixed it =D
I have sort of "generic" event listener for all elements.
I tried in my foolishness before posting here with JTextComponent, but
it didnt worked for me at that place. As a quite total Java newbee I
thought maybe the downcast didnt work with JTextComponent because of
JTextComponent is described with *abstract* keyword...
But the whole issue it didnt worked for me in first place was, that
I had to add at the beginning of file:
import javax.swing.text.JTextComponent;
which solved the problem. As a Java newbee I thought that
import javax.swing.*;
includes all "Swing stuff" but it seems not be the case.
Hope someone will onde day benefit from my explenation.
End of thread.