[BBB-USERS] Re: Binding a JComboBox

  • From: "Rom Yatziv" <ryatziv@entertainmentpartners.com>
  • To: <users@betterbeansbinding.kenai.com>
  • Subject: [BBB-USERS] Re: Binding a JComboBox
  • Date: Tue, 19 Jan 2010 10:30:21 -0800
  • Importance: normal
  • Priority: normal

I understand the principle, but do you have a code sample, by chance?

        BeanProperty cboBoxProp =
BeanProperty.create("selectedItem.code");
        BeanProperty beanOneProp = BeanProperty.create("status");
        Binding b =
Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE,
statusBox, cboBoxProp, beanOne,  beanOneProp);
        b.bind();

This is what I have currently.  There are two problems with this:
1) the bind() call reads the combo box and sets the value on the bean...
I need it to go from the bean to the box.
2) Setting the value on the bean does not affect the box.  The bean
fires propertyChange events, and is otherwise bound to other widgets
property.

-----Original Message-----
From: avital.nahon@gmail.com [mailto:avital.nahon@gmail.com] ;
Sent: Tuesday, January 19, 2010 10:23 AM
To: users@betterbeansbinding.kenai.com
Subject: [BBB-USERS] Re: Binding a JComboBox

Hi Rom

You need read-write binding between "combobox.selectedItem.reference"
and "beanOne.bean2reference"

Regarding the display, you need to change the renderer of combobox by
calling combobox.setRenderer.

If you need to input the description you have to call setEditor and
pass a customized editor and (it gets complicated...  there is a need a
bi-di map between ref and desc).

Good luck

Avital


                
        Rom Yatziv Software Developer Software Development  Tel (818) 
955-4421 | Fax  www.entertainmentpartners.com 
<http://www.entertainmentpartners.com/>  GO GREEN: Please consider the 
environment before you print.        
Disclaimer - January 19, 2010

This email and any attachments are confidential and intended solely for 
users@betterbeansbinding.kenai.com. If you are not a named addressee you are 
prohibited from reviewing, printing, disseminating, distributing, copying or 
altering this email or any part of it. If you have received this 
communication in error, please notify the sender of the error immediately, do 
not read or use the communication in any manner, destroy all copies, and 
delete it from your system if the communication was sent via email. Warning: 
Although Entertainment Partners has taken reasonable precautions to ensure no 
viruses are present in this email, the recipient is responsible for checking 
for and deleting viruses. Entertainment Partners does not accept 
responsibility for any loss or damage arising from the use of this email or 
attachments.


[BBB-USERS] Re: Binding a JComboBox

avital.nahon 01/19/2010

[BBB-USERS] Re: Binding a JComboBox

Rom Yatziv 01/19/2010

<Possible follow-up(s)>

[BBB-USERS] Re: Binding a JComboBox

avital.nahon 01/19/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close