How would I force a Frame to repaint()
immediately after it is maximized, or resized?
I can't find what method is called when that specific operation takes place. I have a bunch of graphics that are written with Graphic objects in paint and their orientation depends on the real time feedback from getWidth()
and getHeight()
but paint isn't called when I maximize, only when those pixels change unfortunately.
Register a ComponentListener:
final Component myComponent = makeTheFrameOrWhatever();
myComponent.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e)
{
myComponent.repaint();
}
});