• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I cater for multiple special events of life?

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My program has the following requirements.
Several kinds of celebration dates are displayed.
Say Marriage, a new baby is born and so on
Such special dates are not fixed to be once or twice.
Such that a person can have a marriage
and a new born baby celebration or both.
One of my thoughts was to used several (up to 3)
JLabels and JDateChoosers, but it is quite limiting.
How should I design such a component so that
it can accommodate several major events of life.
Thanks
Jack
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your wording sounds like those event reminders thing in calendar. Or are your trying to create an event on such and such date?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Dear K. Tsang,
Originally, my program can only have one special event
It is realized by a JDateChooser, but afterwards,
the client said that there might be more special dates
to happen for any person.
So a JTextField is not enough, some one has told
me to use a JButton next to the original text field
and pop up a JDialog when being pressed on.
Is a JTextArea a good choice? or a JDayChooser which has multiple selections
Thanks
Jack
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me that a JTable might work well. The first column would be the description of the event and the second column would be the date of the event. You would need a mechanism for adding a new row to the JTable, but apart from that I think that JTable already does most of what you want.

And notice that it doesn't restrict the number of events that a person can define. As a general principle you should avoid arbitrary restrictions on the number of things in a group -- it's called the "Zero, One, Infinity" rule. In other words the only valid restrictions you can place on the size of a set are (1) must be empty (2) must contain exactly one element (3) can contain any number of elements. That's also related to the database normalization process which removes repeating groups from a table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!