This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Is it possible to bind a component with two other components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Is it possible to bind a component with two other components" Watch "Is it possible to bind a component with two other components" New topic
Author

Is it possible to bind a component with two other components

Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
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
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: 111
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to bind a component with two other components
 
Similar Threads
Ruler in mm
Beans binding with local variable
online business
problem running JBoss 3.2.2 on Win2K with Novell
Eclipse Plugin Development-Creating a Wizard Page with dynamic components