File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is it possible to bind a component with two other components
 
Similar Threads
problem running JBoss 3.2.2 on Win2K with Novell
Beans binding with local variable
Ruler in mm
Eclipse Plugin Development-Creating a Wizard Page with dynamic components
online business