• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionListener  RSS feed

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I add the following calendar into my application (webpage: http://www.java2s.com/Code/Java/Development-Class/BeantodisplayamonthcalendarinaJPanel.htm)
I am opening the calendar via menu option.
The problem is that I don’t know how to retrieve the current date data that I choose.

means: how can I get the selected option from the menu option into the main windows

Thanks
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looking at the code of the calendar there is this set method that seems that it sets the day month and year



so i would suggest to add a new method named getYYMMDD() that will return the String representing the date



ofcourse you can play with this method to make it return a long representing the millis, or construct a Date object that represents the selected date, its your choice and have fun.

(peace)
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if this class is deficient in user interaction ability. If it were my class, I'd have given it an addActionListener method that allowed me to be notified when date buttons were pressed then use a get method as suggested above to extract the selected date.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!