Is it possible to bind a component with two other components
Mahesh Kedari
Ranch Hand
Joined: Nov 28, 2009
Posts: 109
posted
0
Hi,
I need to bind my JTextField with two spinners. Basically, I am trying to calculate Body Mass Index in text field for which I am taking inputs from Spinner1- Height and Spinner2 - weight.
Whenever user changes the value of any spinner, BMI should get reflected in JTextField.
I can do it by adding separate listeners to both spinners. but I wanted to know if it is possible to bind the values of two spinners to this JTextField.
Regards,
Mahesh Kedari - Fidus Technologies Ltd.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
only one spinner will change at a time, and it could be either,
so what's the problem with a changeListener (single class),
added to both spinners (same changeListener).
Mahesh Kedari
Ranch Hand
Joined: Nov 28, 2009
Posts: 109
posted
0
There is no problem with listener Micheal, but I just wanted to know if its possible to add two or more binding components.
I am trying to find out other easier ways to do that task. Off course listeners will be my last option.