Results 1 to 4 of 4

Thread: Form binding with JList and Combobox

Hybrid View

  1. #1

    Default Form binding with JList and Combobox

    I have dialog box looks like the following:


    and have following classes to bind the components in the form
    Code:
    class  DeliveryScheculeBean {
    	private Company company;
    	private List<Date> deliveryDates;
    }
    
    class Company {
       private String name;
       private Address address;
    }
    
    class Address {
        private String street;
        private String city;
        private String state;
        private String zipCode;
    }
    I would like to bind DeliveryScheduleBean.comapany with the item selected in JCombobox with Comapany objects, displaying name. JCombobox is populated with Company objects retrieved from database, and JList is populated with Date objects available for the selected company from the JCombobox.

    when user click on OK button, how do I get the DeliveryScheduleBean pupulated with selected company object, and available dates in the JList using TitledPageDialogBox.

    looking for example binding of combobox, and jlist.
    Last edited by pkbhavani; Jul 30th, 2008 at 12:27 PM.

  2. #2
    Join Date
    Oct 2004
    Location
    Belgium
    Posts
    27

    Default

    You have multiple options, a ListSelectionDialogBinder (explained at http://spring-rich.blogspot.com/) combines a combobox with auto-type filtering, or you could look at the source code of jpetstore, there are some other binding types there, eg the ShuffleListBinder is also very usefull. In all cases, your Form class will contain only a few lines of code, also in jpetstore are a few examples how JComponents can be autobound to certain class types, eg JXDatePicker to a Date.class, etc.

  3. #3

    Default

    To further simplify, dialog box is as follows


    can anyone give me an example of binding JList with arrayList of Date objects in DeliveryScheculeBean

  4. #4
    Join Date
    Jan 2008
    Location
    Toulouse, France
    Posts
    23

    Default

    If you do not need the user to choose for a delivery date within the JList, you can probably populate your bean as you populate your JList.

    What you could do is to retrieve the ValueModel of the "company" property, add a change listener on it, and each time it changes, populate the JList and populate the ValueModel of the "deliveryDates" property.

    Hope this help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •