title: prevent user picking a future time in blackberry + java
body: <p>Can you please tell me how to set a date field to not allow future times to be chosen in blackberry + java?</p>
  
  <p>The user is able to set future times, but I need the user to only be able to set <strong>past</strong> or <strong>current</strong> times - not future.  Is it possible in blackberry + java?</p>
  
  <pre><code>if (field.equals(datePickerBtn)) {
  
      final DateTimePicker dateTimePicker = DateTimePicker
              .createInstance(Calendar.getInstance(), /*"dd:MM:yyyy"*/null, "HH:mm");
  
      Calendar maxCalendar = Calendar.getInstance();
      maxCalendar.set(Calendar.YEAR, 2013);           
      dateTimePicker.setMaximumDate(maxCalendar);
      Calendar minCalendar = Calendar.getInstance();
      minCalendar.set(Calendar.YEAR, 1900);
      dateTimePicker.setMinimumDate(minCalendar);
      calendar = Calendar.getInstance();
  
      UiApplication.getUiApplication().invokeLater(new Runnable() {
          public void run() {
              if (dateTimePicker.doModal()) {
                  calendar = dateTimePicker.getDateTime();
  
                  Date date = calendar.getTime(); 
                  SimpleDateFormat dateFormat = new SimpleDateFormat("dd:MM:yyyy HH:mm");
                  selectedDate = dateFormat.format(date);
                  dateEditTxt.setText(selectedDate);                                  
              }
          }
      });
  }
  </code></pre>