moduleComponent = new JComboBox(ModuleManager.getInstance(project).getSortedModules());
moduleComponent.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
Module module = (Module) value;
label.setText(module.getName());
label.setIcon(module.getModuleType().getNodeIcon(false));
}
return label;
}
});
moduleComponent.setSelectedIndex(0);