Reputation: 1306
I have a standard paintComponent() method that draw some shapes on a Swing JPanel, via Java2D.
Initially, the JPanel surface is displayed with a clean white background.
After the user select a file, I build the shapes (in a separated thread) based on the instructions on the file.
Then, I call JPanel's rapaint() method, you know, will be handled at the EDT.
I can tell when the repaint() processing ends: I just need to look at the new drawings on the screen.
So, this morning I don't have many ideas to answer THE QUESTION: how to know the same information via code?
Upvotes: 0
Views: 232
Reputation: 17794
You don't have any automatic notification, but you can set a boolean variable or call a method at the end of your paintComponent().
Note that normally you should not have this problem, because paintComponent() is supposed to contain only code that executes fast, any initialization/calculation should be moved to another method.
Upvotes: 2