Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraint matches dialog redraw fix #131

Closed
wants to merge 1 commit into from

Conversation

oskopek
Copy link
Contributor

@oskopek oskopek commented Aug 21, 2015

SwingUI Constraint matches dialog now redraws correctly when viewed multiple times in a single solver run

@Override
public void setVisible(boolean visible) {
if (!visible) {
setContentPane(new JPanel()); // force redraw on visible(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setVisible() shouldn't mess with the contentPane.
I suspect this works because it calls Container.validate() indirectly.

IIRC, there are 2 methods in Swing to fix these kinds of bugs:
repaint(); // typically with a custom paint() method this needs to be called, otherwise it's overkill
validate(); (or invalidate()?) // typically changing something invalidates the layout, and Swing wants to wait until all your changes are done before calculating the new layout. validate() is used to signal to Swing that you're done. IIRC...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, of course. I wasn't aware of invalidate(), only of validate(), and that didn't work. Fixed, will push ASAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems not. Will investigate further.

@oskopek
Copy link
Contributor Author

oskopek commented Aug 21, 2015

Decided to refactor a bit (we now create a dialog each time and let the GC take care of it afterwards). I tried just about every combination of (re|in|^)validate and repaint, none of which worked reliably. Also, as this is a modal dialog window, it really makes sense to create it and throw away afterwards.

@psiroky
Copy link
Contributor

psiroky commented Sep 8, 2015

dear Jenkins, retest this please (just for checking the phrase is accepted and test results are correctly reported)

@ge0ffrey
Copy link
Contributor

I can't reproduce this issue (haven't applied the code changes yet). Might you remember a reproduce recipe?

@ge0ffrey
Copy link
Contributor

@oskopek This is good to merge, if we can prove that there is indeed a redraw issue currently (I can't seem to reproduce it).

@oskopek
Copy link
Contributor Author

oskopek commented Jan 26, 2016

Great! I'll take a look at this on Thu.

On Jan 26, 2016 2:24 PM, "Geoffrey De Smet" notifications@github.com
wrote:

@oskopek This is good to merge, if we can prove that there is indeed a
redraw issue currently (I can't seem to reproduce it).


Reply to this email directly or view it on GitHub.

@oskopek
Copy link
Contributor Author

oskopek commented Jan 28, 2016

Cannot reproduce either. Pushed a correctly rebased commit just for fun.

Some other change must have fixed it, or my updated system/JRE did. Closing.

@oskopek oskopek closed this Jan 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants