Re: Component.add ignores addition of same object ???
Superboer wrote:
Hello Sabine,
Thanks for the responce...
But if you want X JTextFields, then you need to create X new
JTextFields. Otherwise, are you trying to display several input fields,
that all refer to the same object? What do you hope to gain from this?
yeah i know but i do sometimes need to display an object twice or
more.....
and this has to be a JTextField or a derived form.
i was kinda baffled that when i add a component, java kicked it out
without telling..
and since i can not find a thing in the manual....
The real question is:
is this allowed or not despite the fact what one wants with it... if
it is
not allowed i need to copy stuff. (not easy and nice....)
Sit on the sofa. Get up, and sit back down again. Are
there now two of you on the sofa? Get up and sit down nine
more times; are there enough of you for a football side?
Or has there just been one Superboer all along, getting
up and sitting back down again?
In your code there is just one JTextField, and you keep
putting it into the JPanel ("onto the sofa") and taking it
out and replacing it again. It's still just one JTextField,
no matter how fidgety it gets.
If you want multiple JTextFields that display and edit
the same text, make them all use the same Document instance.
--
Eric.Sosman@sun.com