• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to bind a component with two other components

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic