-2

I need a help. I am doing a reservation system and my doubt is:

I have 2 JDateChoosers and JTextFields and one JDateChooser is for the start and one is for the end.

For example the user selects a date from the start JDateChooser and after he entered the number of years in the JTextField automatically the end JDateChooser changes the year. The user can't edit the end JDateChooser.

  1. Select the Date from JDateChooser "start".
  2. Enter the number of years in the JTextField.
  3. Automatically the "end" JDateChooser's value changes.
mKorbel
  • 109,525
  • 20
  • 134
  • 319
Mano0114
  • 9
  • 7
  • 1
    Can you post your code? There's no real question here, just what you want to do. What is the *specific* issue you are facing? Compiler error? Unexpected output(s)? Have you read the documentation on Date in Java? – RossC Aug 11 '14 at 13:01

1 Answers1

1

Look into the mediator design pattern.

Basically you will have one object (the mediatory) which will be responsible for coordinating the state between a number of GUI components. So, when one person enters in something in one of the text boxes, that mediator is a listener on the text box, and will set the other GUI component's state accordingly.

Edwin Buck
  • 69,361
  • 7
  • 100
  • 138