Skip to content
Advertisement

Window resize event?

I’m writing a simple painting program using java, and I want some method to be called whenever the JFrame component is resized. But I can’t find any method like windowResizedListener or an event like windowResizedEvent. what can I do?!

Advertisement

Answer

Implement a ComponentAdapter with componentResized():

frame.addComponentListener(new ComponentAdapter() {
    public void componentResized(ComponentEvent componentEvent) {
        // do stuff
    }
});
3 People found this is helpful
Advertisement