Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/09/2014, 09:22
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 9 años, 8 meses
Puntos: 182
Respuesta: jComboBox para Años

Código Java:
Ver original
  1. private JComboBox getCbAnyo() {
  2.         if (cbAnyo == null) {
  3.                         List<Integer> lstAnyos = new ArrayList<>();
  4.                         int year = Calendar.getInstance().get(Calendar.YEAR);
  5.                         for (int i = 1920; i<= year; i++) {
  6.                               lstAnyos.add(i);
  7.                         }
  8.  
  9.                         cbAnyo = new JComboBox();
  10.                         cbAnyo.setModel(new DefaultComboBoxModel(lstAnos.toArray(new Integer[lstAnyos .size()]);
  11.  
  12.         }
  13.         return cbAnyo;
  14.     }