Drawing outside the paint() method
Posted on 1998-03-26
I want to do the following:
After a Panel in a Panel is drawn with its Components I want to draw the borders of that inner Panel. I tried to do the following:
public void drawLabeledBounds(Container container, String label)
Graphics gc = container.getGraphics();
FontMetrics fm = gc.getFontMetrics();
int length = container.size().width;
int height =container.size().height;
//and even this doesn't work:
...}// end drawLabeledBounds
How can I realize to draw the bounds of that inner Panel (I want to put a String into the upper edge later!).
Presently it is painted but then taken away (perhaps through the validate() method I have to call because the size of the Components change during initialization).
By the way, all the other Panels (including the outer Panel of the Panel we've talked about!) have a 3D-Border and I realized it by invoking the method responsible for drawing the borders out of the paint() method.
But doing this the same way with the inner Panel it doesn't work!!! Why???