Component Listener for dock size change

Hi Beni,

I cannot figure out how to add a ComponentListener to a dock so that the code gets notified when the size of the dock changes.

Under J2SE for a JFrame, you implement a ComponentListener to the class and add the 4 standard methods and one of them is componentResized().

Do you have a sample?

Regards,
Roger

Hi Roger,

Just add a ComponentListener to the Component that represents the Dockable. Like this:

CDockable dockable = …
Dockable intern = dockable.intern()
intern.getComponent().addComponentListener( new MyComponentListener( … ) )

DockingFrames does not have a special method for tracking the size of a Dockable.

You might also be able to get some results by adding a „CDockableLocationListener“ to the „CDockable“. But that listener is intended to be notified if the position (e.g. the parent) of a Dockable changes - notifications of changed size is a side effect at best, and not guaranteed.

Hi Beni,

Thanks. It worked. Here’s what I used:

Dockable intern = dockable.intern();
intern.getComponent().addComponentListener(new ComponentAdapter()
{
   public void componentResized(ComponentEvent ev)
   {
      // handle dock being resized
   }
});

Regards,
Roger