Z-order components and Graphics



how can i draw a rectangle and this rectangle will be on top of all my components ?



Is Component::paintOverChildren what you are looking for?


Hi cpr, thank you for your answer, perhaps it is, but question is how to use it.

I want to draw some line about some components and i have in MyComponent::paint(....

g.fillRect(0, 56 + 56, proportionOfWidth(1.0f), 2);
g.fillRect(0, 56 + proportionOfHeight(1.0f) -56-32-15, proportionOfWidth(1.0f), 2);

I have put Component::paintOverChildren(g); before this and nothing happen. How to use it ?




paintOverChildren allows a parent to paint over the top of all it's children. You override paintOverChidlren, and put in the code for the things you want painted over everything else. For example, I have some UI that allows the user to draw lines between components,. first, all of the components get painted, then I draw all of the connecting lines in paintOverChildren.


Thank you cpr