Thank you, Fred Kleinschmidt, for the explanation and your advice!
Thank you, Junilu Lacar. Yeah, there is a mistake ))) I should improve my English. =)
1. Define a class variable "circleColor" in the class "MyDrawPanel" and change it in the method "changeColor". Remove the code which changes the color from the method "paintComponent" to fix this problem.
2. In the inner class "ColorListner" of the class "TwoButtons" call the method "changeColor" which changes the variable "circleColor".
Sorry for my English =) I could make some mistakes.
HI, all. I've started to learn Java and struggled with a task TwoButtons (chapter 12). When I click the button "Change label" it's also changes the color of my circle, it seems that it repaints the JFrame. And when I resize the window, the circle changes the color. I've experimented with the code a little to understand how it works. And I think that if something changes in the window it repaints all the frame. Am I right? Did I something wrong?
Thanks!