As a container component

I have an application with two main panels LEFT and RIGHT, I want to know when a component as a container that contains this component (LEFT or RIGHT) the component can be inside some other panel, but ends up inside the panel "LEFT" or " RIGHT"

there is an easier way to find out who the container is without looping to get the parent every time the component gets focus

Thank you

+2


a source to share


1 answer


I think I got it

pnla.setFocusCycleRoot(true);
pnla.setFocusTraversalPolicy(new JTPCScreenMainFocusTraversalPolicy());

pnlb.setFocusCycleRoot(true);
pnlb.setFocusTraversalPolicy(new JTPCScreenOptionsFocusTraversalPolicy());

      

and when the component is focused I ask



component.getFocusCycleRootAncestor() instance of PNL_A 

      

thanks

0


a source







All Articles