Reputation: 1122
I'm learning Java as part of my degree but its very brief but what ever I do I like to make sure I atleast have some understanding.
Until now anything that I want displayed on the screen is put into the paintcomponent
method of the JPanel
.
However, I have drawn out some parts of my layout which never change, and only a certain thing in the middle rotates.
I have a timer which calls repaint()
.
If I correct in thinking that everything including the components that never change are being removed and then redrawn and the whole paintcomponent
method is being run every time.
To me I feel like I should (or there must be) a way where the static stuff is moved out / is only drawn once, and only the parts that I specifically want to be redrawing should stay in the paintcomponent
method?
Is this correct or am I not fully understanding something?
Upvotes: 0
Views: 1016
Reputation: 285403
repaint(...)
that sets a bounding rectangle for the region to be painted.Upvotes: 2