Search code examples
javaswingeventsjframecomponentlistener

Any alternatives to the componentResized method in ComponentAdapter


When I implement the code below, the method is only called when the user releases the mouse after resizing a frame. I want a method that is called continuously as the user is resizing the frame. What can I do instead?

frame.addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent comp) {
        System.out.println("Resized");
        }
      });

Solution

  • //frame.addComponentListener(...
    frame.getContentPane().addComponentListener(...