Imagine this situation. I have main JFrame window and another one which pops out from the main window, by button click. What should I do if I want to repaint graph in main window by clicking the button on the popped up window?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The popped up window needs a reference to the main window. So in the constructor of the popped up window you will accept a reference to the main window and keep it until needed.
In the main window you can write a method update() that can be called from the popped up window and cause the main window to repaint itself accordingly. For example:
and in the popped up window: