private void actionPreformedItemStateChaned(JComboBox combo)
{
int sel = combo.getSelectedIndex();
if (!this.getColorChoice(sel).isEnable()) {
if (sel + 1 > combo.getItemCount() - 1) {
sel = -1;
}
combo.setSelectedIndex(sel + 1);
}
}
private class ListCellRender extends DefaultListCellRenderer
{
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected,
boolean cellHasFocus)
{
if (index > -1) {
if (!getColorChoice(index).isEnable()) {
this.setText(value.toString());
this.setForeground(Color.lightGray);
return this;
}
else {
this.setText(value.toString());
this.setForeground(Color.black);
return this;
}
}
else {
this.setText(value.toString());
this.setForeground(Color.black);
return this;
}
}
}
private class ComboListener implements ItemListener
{
public void itemStateChanged(ItemEvent event)
{
if (ItemEvent.SELECTED == event.getStateChange()) {
JComboBox selectedChoice = (JComboBox) event.getSource();
if (selectedChoice != null) {
actionPreformedItemStateChaned(selectedChoice);
}
}
}
}