> How to find the text fields name in Document class ?
You can't. A Document can be shared between multiple JTextFields. So there is no one to one mapping.
If you think you need the name of the text field, then you are approaching your problem incorrectly. If you state what you are actually trying to do we can probably provide an alternate solution.
> im trying to find which text field is currently in use(typing)
Why do you care? Are you doing some custom editing to make sure the data is valid. You should not be using a KeyListener to validate text as it is entered. Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html]Using Text Fields[/url]. It shows you different ways to validate the data, The "Text Component Features" link shows how to use a DocumentFilter.
actually my need is
when am typing in to text field the text will be get and .to use this data select some data on data base and it will be display on a table
for example iam typing 'A" the data start with a will be display on table
it is working properly
But the problem is am using two or more text and and inner class extended by palinDocument .the result on the table will be depends up on the which text field is currently am using
How i cam find which text field is currently am using with out using any listeners
To determine which text field had focus, you could add the same focus listener
to each field which simply sets a variable in the focusGained method to the
source of the event.
You could also create your own TextAction subclass and provide a method
which simply returns the last focused text component. Of course, if you have
text components other than the ones you're dealing with here, they could be
returned as well.