// Support a date in the MEDIUM format in the current locale; // see Formatting and Parsing a Date Using Default Formats. // For Locale.ENGLISH, the format would be Feb 8, 2002. JFormattedTextField tft1 = new JFormattedTextField(new Date()); // Support a date in the SHORT format using the current locale. // For Locale.ENGLISH, the format would be 2/8/02. JFormattedTextField tft2 = new JFormattedTextField(DateFormat.getDateInstance(DateFormat.SHORT)); tft2.setValue(new Date()); // Support a date with the custom format: 2002-8-2 JFormattedTextField tft3 = new JFormattedTextField(new SimpleDateFormat("yyyy-M-d")); tft3.setValue(new Date()); // See also Formatting a Date Using a Custom Format // Retrieve the date from the text field Date date = (Date)tft3.getValue();