JList data binding not working. [message #717333] |
Fri, 19 August 2011 22:30  |
Eclipse User |
|
|
|
so I created a JList component and a simple "add user" button and the username text input field.
I right click on JList and add self to Users.people and detail binding on Person.username;
public class Users {
public List<Person> people = new ArrayList<Person>();
public List<Person> getPeople() {
return people;
}
public void addPerson(Person person) {
people.add(person);
}
}
public class Person {
public String username ="";
public String location ="";
public Person(String name){
username = name;
}
public String getUsername() {
return username;
}
}
so on "add user" button click:
actionPerformed(){
users.addPerson(new Person("Jim"));
}
The code runs, and I click on the "Add user" button. I output the size() of people array, and it's increasing, but nothing is being updated on the JList component. I expected it to fill up with "Jim"s but it didn't happen.
I spent days on this and can't find out what is being wrong or what I am overlooking.
|
|
|
|
|
|
Re: JList data binding not working. [message #775151 is a reply to message #717412] |
Thu, 05 January 2012 08:08   |
Eclipse User |
|
|
|
This is related to Swing Binding example,
I did the binding between text fields and table, but when I select a row on the table, the text fields are not not getting updated, Do I need to add any code for the source ?? If yes, Please let me know where to add that.
I am trying to develop the same application that was given in SwingBinding tutorial,
I spent 3 days on this, till now I didn't get any answer to it.
Please help me on this.
Thanks in advance.
Attachment: Frst.png
(Size: 510.67KB, Downloaded 365 times)
Attachment: second.jpg
(Size: 183.88KB, Downloaded 339 times)
|
|
|
|
|
Re: JList data binding not working. [message #775699 is a reply to message #775504] |
Fri, 06 January 2012 09:42  |
Eclipse User |
|
|
|
I can't tell you what is wrong with your code without actually seeing it. From your comments, all I can do is guess that your domain objects don't meet the requirements of the Swing Data Binding Framework (JSR 295). Your domain objects are your responsibility while WindowBuilder is only responsible for generating the data binding code in your UI class. If you aren't understanding the domain objects provided with the tutorial, you should review the requirements of the Swing Data Binding Framework with respect to domain objects. This forum is not the place to learn that framework or ask general questions about it. WindowBuilder assumes that you are already familiar with it, so one suggestion is to build a small example by hand so that you understand it from start to finish. You can certainly start with the code provided in the tutorial as that is complete and includes a complete set of domain objects (including an AbstractModelObject you can use as the parent for your domain object classes).
|
|
|
Powered by
FUDForum. Page generated in 0.03228 seconds