Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2289
| Newsgroups | comp.lang.java.help |
|---|---|
| Date | 2012-11-29 11:21 -0800 |
| References | <9b70426c-e378-4852-bc77-fc67440a93ef@googlegroups.com> |
| Message-ID | <9d60511c-a776-4861-a7d6-94f8620e92f4@googlegroups.com> (permalink) |
| Subject | Re: How to implement jcombobox with name value pair from database? |
| From | kedward777@gmail.com |
Why won't this work?????
class Employee
{
private int id;
private String name;
public Employee(int id, String name)
{
this.id = id;
this.name = name;
}
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public String toString()
{
return name;
}
}
Vector model = new Vector();
model.addElement(new Employee(1111, "me1" ));
model.addElement(new Employee(1112, "me2" ));
model.addElement(new Employee(1113, "me3" ));
model.addElement(new Employee(1114, "me4" ));
model.addElement(new Employee(1115, "me5" ));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(model));
Employee myItem = new Employee(1114,"me4");
jComboBox1.setSelectedItem(myItem);
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to implement jcombobox with name value pair from database? rogerdoger777 <kedward777@gmail.com> - 2012-11-29 09:14 -0800
Re: How to implement jcombobox with name value pair from database? kedward777@gmail.com - 2012-11-29 11:21 -0800
Re: How to implement jcombobox with name value pair from database? Roedy Green <see_website@mindprod.com.invalid> - 2012-12-04 18:08 -0800
Re: How to implement jcombobox with name value pair from database? Knute Johnson <nospam@knutejohnson.com> - 2012-11-29 12:55 -0800
Re: How to implement jcombobox with name value pair from database? Lew <lewbloch@gmail.com> - 2012-11-29 13:12 -0800
Re: How to implement jcombobox with name value pair from database? Knute Johnson <nospam@knutejohnson.com> - 2012-11-29 15:05 -0800
Re: How to implement jcombobox with name value pair from database? Lew <lewbloch@gmail.com> - 2012-11-29 16:08 -0800
Re: How to implement jcombobox with name value pair from database? kedward777@gmail.com - 2012-11-29 13:17 -0800
csiph-web