public void actionPerformed(ActionEvent e){
  if (m_setting)   return;
  setTime();
  if (e.getSource() == bOK) {
    m_abort=false;
    dispose();
    return;
  }
 else   if (e.getSource() == bBack) {
    if (--m_currentMonth < 1) {
      m_currentMonth=12;
      m_currentYear--;
    }
    m_lastDay=-1;
  }
 else   if (e.getSource() == bNext) {
    if (++m_currentMonth > 12) {
      m_currentMonth=1;
      m_currentYear++;
    }
    m_lastDay=-1;
  }
 else   if (e.getSource() instanceof JButton) {
    JButton b=(JButton)e.getSource();
    String text=b.getText();
    if (text.equals("*")) {
      m_calendar.setTime(new Timestamp(System.currentTimeMillis()));
      m_currentDay=m_calendar.get(java.util.Calendar.DATE);
      m_currentMonth=m_calendar.get(java.util.Calendar.MONTH) + 1;
      m_currentYear=m_calendar.get(java.util.Calendar.YEAR);
      m_current24Hour=m_calendar.get(java.util.Calendar.HOUR_OF_DAY);
      m_currentMinute=m_calendar.get(java.util.Calendar.MINUTE);
    }
 else     if (text.equals("x")) {
      m_cancel=true;
      dispose();
      return;
    }
 else     if (text.equals(Msg.getMsg(Env.getCtx(),"Key_Clear"))) {
      m_clear=true;
      dispose();
      return;
    }
 else     if (text.length() > 0) {
      m_currentDay=Integer.parseInt(text);
      long currentClick=System.currentTimeMillis();
      if (m_currentDay == m_lastDay && currentClick - m_lastClick < 1000) {
        m_abort=false;
        dispose();
        return;
      }
      m_lastClick=currentClick;
      m_lastDay=m_currentDay;
    }
  }
 else   if (e.getSource() == cbPM) {
    setTime();
    m_lastDay=-1;
  }
 else {
    m_currentMonth=cMonth.getSelectedIndex() + 1;
    m_lastDay=-1;
  }
  setCalendar();
}

public void actionPerformed ( ActionEvent e ) { if ( m_setting ) return ; setTime ( ) ; if ( e . getSource ( ) == bOK ) { m_abort = false ; dispose ( ) ; return ; } else if ( e . getSource ( ) == bBack ) { if ( -- m_currentMonth < 1 ) { m_currentMonth = 12 ; m_currentYear -- ; } m_lastDay = - 1 ; } else if ( e . getSource ( ) == bNext ) { if ( ++ m_currentMonth > 12 ) { m_currentMonth = 1 ; m_currentYear ++ ; } m_lastDay = - 1 ; } else if ( e . getSource ( ) instanceof JButton ) { JButton b = ( JButton ) e . getSource ( ) ; String text = b . getText ( ) ; if ( text . equals ( "*" ) ) { m_calendar . setTime ( new Timestamp ( System . currentTimeMillis ( ) ) ) ; m_currentDay = m_calendar . get ( java . util . Calendar . DATE ) ; m_currentMonth = m_calendar . get ( java . util . Calendar . MONTH ) + 1 ; m_currentYear = m_calendar . get ( java . util . Calendar . YEAR ) ; m_current24Hour = m_calendar . get ( java . util . Calendar . HOUR_OF_DAY ) ; m_currentMinute = m_calendar . get ( java . util . Calendar . MINUTE ) ; } else if ( text . equals ( "x" ) ) { m_cancel = true ; dispose ( ) ; return ; } else if ( text . equals ( Msg . getMsg ( Env . getCtx ( ) , "Key_Clear" ) ) ) { m_clear = true ; dispose ( ) ; return ; } else if ( text . length ( ) > 0 ) { m_currentDay = Integer . parseInt ( text ) ; long currentClick = System . currentTimeMillis ( ) ; if ( m_currentDay == m_lastDay && currentClick - m_lastClick < 1000 ) { m_abort = false ; dispose ( ) ; return ; } m_lastClick = currentClick ; m_lastDay = m_currentDay ; } } else if ( e . getSource ( ) == cbPM ) { setTime ( ) ; m_lastDay = - 1 ; } else { m_currentMonth = cMonth . getSelectedIndex ( ) + 1 ; m_lastDay = - 1 ; } setCalendar ( ) ; }
action listener for month / year combo & date buttons . - double clicking on a date closes it - set m_current . . .
