refreshing a dialog?

What would be the best way to go about this issue I am having.  On my dialog I have 4 change buttons.

Project:  [   text   ]   [ change ]
3d:         [   text   ]   [ change ]
2d:         [   text   ]   [ change ]
Email:     [   text   ]   [ change ]

When the dialog is created the only button enabled is change project.  The bottom 3 fields are based off what project is selected, so that can not change the values until a project is selected.
The value for Project when the dialog is created is "NO SELECTED PROJECT" - I will then click the change project button and select a project.  Right now all the bottom fields are populated and I want the change buttons for them to now be enabled.

so I wrote a if statement around the enable piece of code for the buttons

     final JButton threeDButton = new JButton("Change");
      threeDButton.setPreferredSize(new Dimension(100, 20));
      if (checkProject == 1) {
       else {
but the dialog is never created again or redrawn to where this way will work.  Not sure it is good practice to refresh your main dialog often.
What do you think is the best way to do this check?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The buttons should be enabled by one of the Project controls listeners
The 'proper' way of doing it would be to make the buttons listen for a change for the 'project' or 'selectedProject' property of whatever class contains that property:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkteaterAuthor Commented:
So you have a propertychange listener and in the listener action you would set all the buttons to enabled?
Set the listener to run when the value of currentPorject is changed?

I have never seen a property Change listener before
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

>>So you have a propertychange listener and in the listener action you would set all the buttons to enabled?


>>Set the listener to run when the value of currentPorject is changed?

That would have automatically
Your buttons should have normal ActionListener attached.
When you click the button - I jguess you popup the dialog where the user selects the project - in that dialog you should have a method
which should set enabled -disables on these buttons in the original winodw simultaneously with changing the text
in this original winodw.
You just pass a a varaibale holding original dialog to the pop-up dioalog and through that varaible pointing at the instance of original dialog you
can modify properties of the elements - button textboxes of the original window
Keep in mind though that just enabling - diosabling buttons affects only theur appaerance - if you want to enable/disable theier action
you need  remove the listener to disable and add the listener to enable
In general if it is about selecting the project from the list - consider JComboBox rather than the button with additional window popping up.
With JComboBox you can add ItemListener and use it to monitor if project is slecetd or not - I think it would be easier than with buttons, unless
the selctinon fo theproject is mnore sophistuicated than juts selecting form a list
jkteaterAuthor Commented:
Both suggestions was helpful
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.