Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to bind a component with two other components

 
Mahesh Kedari
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic