Adding a function to the StretchableLayoutManager


i’m working an a cool Docker component with dynamic placing possibilities that easily wraps many StretchableLayoutManagers, so that is possible to write complex resizing guis in a couple of lines. actually i’m adding drag and drop to the inner components so you can interchange their positions, while maintaining the structure.
could be possible to add to the StretchableLayoutManager a function that returns the itemIndex that is under the mouse (passing the mouse coord) so i can find which itemLayout the user dropped the component ?
probably i’m just too lazy to write that function, but i see it more confortable and logic to have in the StretchableLayoutManager…
i think this could be done also with findComponentUnderMouse (in Desktop class maybe) but then i have to manually search through my tree of layouts until i find the correct component. any ideas ?


Sounds like fun. Surely the sensible way to do it is just to make sure there’s a component in each section, and make them all implement DragAndDropTarget, so the d+d code can take care of all the dragging and dropping automatically?


i’ve found the correct way to do it.
i’ve made the “dock component” the target, so i’ll be able to go through the inner panels and swap the components that are being dragged/dropped without having the constraint to handle target in each component (and keep a pointer to the dock panel they’re in). this way you can handle in one target all the docking logic of it’s sub components…

look at the useful tools forum.