Like the JCombobox ListCellRenderer, I have a class similar to this:
class ZComboBoxRenderer extends JPanel implements ListCellRenderer{
private ZGrid grid;
public ZComboBoxRenderer(ZGrid grid) {
setLayout(new BorderLayout());
this.grid = grid;
add(new JScrollPane(grid), BorderLayout.CENTER);
}
public ZGrid getGrid(){
return grid;
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
grid.fetchSQL();
return this;
}
}
ZGridhere continues JTable.
Like a ListCellRendererComponent, I provide the JPanel that has ZGridinside, before JCombobox. The problem is that in her list this ZGrid is drawn correctly. But it is also painted inside the JCombobox editor. I uploaded an image to show it better.
Is there a way to separate the editor from the list?
alt text http://img444.imageshack.us/img444/564/soex.jpg
source
share