Crop frame when resizing?

How can I force a frame repaint()immediately after maximizing or changing it?

I cannot find which method is called when this particular operation occurs. I have a bunch of graphics that are written by graphic objects in paint, and their orientation depends on real-time feedback from getWidth()and getHeight(), but the paint is not called when I maximize, only when these pixels are unfortunately.

+3
source share
2 answers

Register ComponentListener:

final Component myComponent = makeTheFrameOrWhatever();
myComponent.addComponentListener(new ComponentAdapter() {
    @Override
    public void componentResized(ComponentEvent e)
    {
        myComponent.repaint();
    }
});
+15
source

, repize() paint(), , - , . , , repaint , , , , , , . , , , .

, , , .

+1

Source: https://habr.com/ru/post/1720132/


All Articles