How to use .DefaultListCellRenderer
Posted
by loddn
on Stack Overflow
See other posts from Stack Overflow
or by loddn
Published on 2010-03-26T10:15:38Z
Indexed on
2010/03/26
10:23 UTC
Read the original article
Hit count: 141
First, i'm new at Java-programming and my native lang is not english, but still i hope to get some help from you all. What I try to do is a simple java-interface with a jComboBox and a jList. I want to poplate to jComboBox with Object-names and when the user select one of the names get the object-id which i will use to populate the jList. It's probably simple but i have bin stuck with this problem all day.
private void loadComboBox() {
biz.Object object = new biz.Object();
try {
ArrayList<biz.Object> arrayOfObjects= object.getAllObjects();// ArrayList of objects
for (biz.Object o:arrayOfObjects)
{
if (o != null)
cbm.addElement(o); //`toString-method
}
cb.setModel(cbm); //JComboBox
© Stack Overflow or respective owner