Thanks for your reply camickr. I really appreciate it, I played around with that example for awhile, but I am still having trouble implementing what I want to do. Let me ask the question in a different way.
So say I have the following tables:
CREATE TABLE A (
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
NAME VARCHAR(50),
TYPE VARCHAR(50)
);
CREATE TABLE B (
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
DAYOFWEEK VARCHAR(50),
LENGTH INT
);
In my ComboBox, I want it to display the NAME from TABLE A and the DAYOFWEEK and LENGTH from TABLE B
I was hoping something like the following would work, but it casts a class exception.
public class ClassIDCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null)
{
Tablea a = (Tablea)value;
Tableb b = (Tableb)value;
setText( a.getName() + " " + b.getDayofweek() + " " + b.getLength() );
}
return this;
}
}
Thanks again for your help. Sorry I didn't catch on to the first example.
-Kevin