Surely with this example you can guide yourself better.
Enum class
public enum DiasSemanas {
LUNES, MARTES, MIERCOLES, JUEVES, VIERNES, SABADO, DOMINGO;
}
Then a class that implements it
public class Enumeraciones {
public Enumeraciones() {
super();
}
public void actividadesDiarias(DiasSemanas ds) {
switch(ds) {
case LUNES:
System.out.println("Es el primer dia de la semana");
break;
case MARTES:
System.out.println("Es el segundo dia de la semana");
break;
case MIERCOLES:
System.out.println("Es el tercer dia de la semana");
break;
case JUEVES:
System.out.println("Es el cuarto dia de la semana");
break;
case VIERNES:
System.out.println("Es el quinto dia de la semana");
break;
case SABADO:
System.out.println("Es el sexto dia de la semana");
break;
case DOMINGO:
System.out.println("Es el septimo dia de la semana");
break;
default:
System.out.println("Opcion no valida...!!!");
break;
}
}
and finally I execute it from a main class
public class Ejemplos {
public static void main(String[] args) {
// TODO Auto-generated method stub
Enumeraciones enumeraciones = new Enumeraciones();
enumeraciones.actividadesDiarias(DiasSemanas.LUNES);
enumeraciones.actividadesDiarias(DiasSemanas.MIERCOLES);
String[] lista = { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes","Sabado", "Domingo" };
JComboBox combo = new JComboBox(lista);
combo.setSelectedIndex(0); // establecemos el primer valor por defecto
combo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.out.println("Evento");
if (combo.getSelectedIndex() == 5) {
enumeraciones.actividadesDiarias(DiasSemanas.SABADO);
}
}
});
JFrame ventana = new JFrame();
ventana.getContentPane().setLayout(new FlowLayout());
ventana.getContentPane().add(combo);
ventana.pack();
ventana.setVisible(true);
ventana.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
Here only what you have left is in this last class to implement the JComboBox