• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving parsed date  RSS feed

 
Bart Boersma
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am currently working on a project where I am displaying only the day within a certain month. Thus, 25th of December, 2016 would show 25. This is done via a DateTimeFormatter and then the formatted date (in a String) is added to a JLabel (and eventually a JPanel and JFrame).

The problem I am facing is that I would like to retrieve the "old date format". Thus, if 25 is being clicked (given to the JLabel) I would like to somehow retrieve that 'behind' the 25 is 25th of December, 2016. See below the simplified code.

Let me know if I need to provide any additional information to help me further.

Thanks in advance!

 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was going to suggest creating your own DayLabel class...but even simpler is, just use the newdate object inside the ActionListener.
You have access to it (though you might need to make it final).
 
Bart Boersma
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That indeed did the trick Dave!

Thanks for your reply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!