Mapping data from one text field to the other text field.

Can i map the data in one text field to the other text field?

I mean I have one window with text field emp_id in one window and i want to mapp its data to the other text field say emp_no in other window.

is this possible using swing?

Can any body help.

Thanks and regards.

[303 byte] By [Deshmukh_s_sa] at [2007-10-2 6:20:23]
# 1
What do you mean by the verb 'map'?In other words, what process do you want?
hiwaa at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...
# 2

> Can i map the data in one text field to the other

> text field?

> I mean I have one window with text field emp_id in

> one window and i want to mapp its data to the other

> text field say emp_no in other window.

> is this possible using swing?

> Can any body help.

> Thanks and regards.

In short yes.

Assuming you have a data model (M) which relates id and num then build your C (as in MVC) to listen to your first text field, access your M to update your second text field. If it's in a different window make sure your C has a reference for it.

Gargoylea at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...
# 3
JTextField tf1 = new JTextField();JTextField tf2 = new JTextField();tf2.setModel( tf1.getModel() );
camickra at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...
# 4
> What do you mean by the verb 'map'?> In other words, what process do you want?I think he wants to do something like select one item from a master list and then display and edit it in a separate field.
Gargoylea at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...
# 5

> > What do you mean by the verb 'map'?

> > In other words, what process do you want?

>

> I think he wants to do something like select one item

> from a master list and then display and edit it in a

> separate field.

And automatically synching both?

It should be a DocumentListener's job, then.

hiwaa at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...
# 6

> > What do you mean by the verb 'map'?

> > In other words, what process do you want?

>

> I think he wants to do something like select one item

> from a master list and then display and edit it in a

> separate field.

And automatically synching both?

It should be a DocumentListener's job, then.

hiwaa at 2007-7-16 13:22:18 > top of Java-index,Desktop,Core GUI APIs...