4 Replies Latest reply: Mar 9, 2009 6:53 PM by 807588 RSS

    Problems with Calendar

    807588
      Hi guys - I'm creating what I thought would be a simple app.
      The user would have a date on the screen, and could click a button to move the day forward one, or the month forward one, etc.
      I started off by using a Calendar, but all the variables are final and appear to be set once when the program initiates.

      Is there some sort of Calendar I can use which does not set everything as final and can be modified by buttons such as in the app I mentioned above?

      Apologies for lack of source code!
        • 1. Re: Problems with Calendar
          807588
          I think you are misunderstanding java.util.Calendar. It is mutable. Put the GUI aside and get some non-GUI code working that does what you are trying to do with a Calendar object.
          • 2. Re: Problems with Calendar
            807588
            Oh, right. It certainly didn't seem that way when I was trying to get it to work.
            So what you are saying is that I could have a Calendar called say example, and it is possible to change the variables (i.e. month, day etc.) in this?
            • 3. Re: Problems with Calendar
              807588
              LSimpson1986 wrote:
              I started off by using a Calendar, but all the variables are final
              Which variables?

              I looked in the API and cannot see anything declared as final.
              • 4. Re: Problems with Calendar
                807588
                LSimpson1986 wrote:
                Oh, right. It certainly didn't seem that way when I was trying to get it to work.
                So what you are saying is that I could have a Calendar called say example, and it is possible to change the variables (i.e. month, day etc.) in this?
                Have you read the documentation? Feel free to do so now: [http://java.sun.com/javase/6/docs/api/java/util/Calendar.html]