title: How to get the date from JFormattedTextField with a Mask
body: <p>I've spent a lot of time reading Java docs and related questions but am still unable to understand exactly what I need to do to accomplish what I want.</p>
  
  <p>I know that I will be using a <code>MaskFormatter</code> (because I want <code>/  /</code> always displayed), <code>SimpleDateFormater</code> and <code>DocumentListeners</code> so I spent most of my time studying those but can't figure out how to use everything together. </p>
  
  <p>I have a <code>JFormattedTextField</code> that uses a <code>MaskFormatter("##/##/####")</code> which I want to end up being stored as a Date in the format of <code>MM/dd/yyyy</code>.</p>
  
  <pre><code>    private JFormattedTextField weekEndingData = new JFormattedTextField(createFormatter("##/##/####"));
      private String dateString = weekEndingData.toString();
      private SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy");
  </code></pre>
  
  <hr>
  
  <pre><code>        private MaskFormatter createFormatter(String s) {
          MaskFormatter formatter = null;
          try {
              formatter = new MaskFormatter(s);
          } catch (java.text.ParseException exc) {
              System.err.println("formatter is bad: " + exc.getMessage());
              System.exit(-1);
          }
          return formatter;
      }
  </code></pre>
  
  <p>This date reflects the "week ending date" which is Sunday in my case. This date will be sent to a database and will also be used to automatically display the dates of the rest of the days in the week. So for example:</p>
  
  <p>If the week ending date entered by the user is 3/30/2014, then a JLabel on the form will fill in as 3/30 under the text "Sunday", and 3/29 under Saturday, and so on till monday. Which brings me to my next issue, subtracting dates.</p>
  
  <p>I've done research and just about everywhere points towards JodaTime, but I also saw someone mention that the new Java8 JDK addresses much of the previous weak points for Java in terms of Dates. </p>
  
  <p>I am looking for guidance in terms of mapping/listing out my requirements for what I want to accomplish because I feel very muddled and can't seem to find strong enough direction. I am also hoping for any feedback on the way JDK8 uses dates and if it is a better choice than Joda. (I know subjectiveness is frowned upon here but I don't know where else to ask.)</p>
  
  <p><strong>EDIT</strong> a visualization may help. This Panel will be printed so a JSpinner is unfavorable. The yellow is only there temporarily to help me visualize space distribution. 
  <img src="https://i.stack.imgur.com/IM4Pl.png" alt="this"></p>