I am creating a "chart" component to display signals - time - frecuency, etc.
So I created a component "chart". I draw on it some stuff as a window frame, x and y axis, labels and so on. At the same time it contains another component called "graph", in which i paint the graphic using the following at the paint():
lines.addLineSegment(Line<float>(0, y, x, y), 20.0f);
And i create as many graphs components as signals I want to draw.
Well, I use a timer to update the graph every "x" ms, so I call, for example, from MainComponent :
And it works, but this method also calls paint() parent method, so "chart" paint() method is redrawn all the time (frame, x y axis, labels, and so on). And not only this but graph2.paint() is also being called, so just calling Chart.graph1.repaint(); also repaints graph2.
Is it normal?or is there any way that parent paint methods are not called from children?I have tried to override the repaint() method (doing nothing) in parent class to see if this method was called instead of paint(), but both are executed.
I have seen in the demo, box2D, that there is an animation plus a listbox in the screen, and everytime the animation is refreshed, the listbox is repainted over and over again also, even without having had any change.
Is it so how it works by default, and the parent paint method is all the time being executed even without having any changes....??
I have read paintoverchildren method but I dont know how to use it :(
Is there any other way to redraw a graphic or whatever besides repaint()??I mean, can I write my own method to repaint??since it seems that "Graphics& g" is only to be used at paint() method, I haven't been capable of declaring a Graphich component in my own function and use it as g.fillAll or fillpath or so.
I hope i have explained myself :D
Best regards and thanks in advance folks!!!