/** Formats and displays today's date. */ public void reformat() { Date today = new Date(); SimpleDateFormat formatter = new SimpleDateFormat(currentPattern); try { String dateString = formatter.format(today); result.setForeground(Color.black); result.setText(dateString); } catch (IllegalArgumentException iae) { result.setForeground(Color.red); result.setText("Error: " + iae.getMessage()); } }