• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I cater for multiple special events of life?

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic