public void actionPerformed(ActionEvent event){ if (event.getSource() == button) { GregorianCalendar getnow = new GregorianCalendar(2002,5,4); //Date d = getnow.getTime(); //DateFormat dfnow = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); //String now = dfnow.format(d); //-> // System.out.println(now); //<- day_str = day_txt.getText(); int dayint = Integer.parseInt(day_str); System.out.println(dayint); month_str = month_txt.getText(); int monthint = Integer.parseInt(month_str); System.out.println(monthint); year_str = year_txt.getText(); int yearint = Integer.parseInt(year_str); System.out.println(yearint); month = monthint - 1; GregorianCalendar getfar = new GregorianCalendar(yearint,month,dayint); //Date g = getfar.getTime(); //DateFormat dffar = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); //String far = dffar.format(g); //-> // System.out.println(far); //<- days = 0; if(getnow.before(getfar)) { getnow.add(GregorianCalendar.DATE, 1); days++; } System.out.println(days); }}