2

i have an application with two main panel LEFT and RIGHT when a component got focus i want to know how is the container that holds that component (LEFT or RIGHT) the component can be inside some other panel's , but eventually sits inside the LEFT or RIGHT panel

is there a more simple way to know who is the container without running in loop on get parent each time a component got focus

thank you

skaffman
  • 398,947
  • 96
  • 818
  • 769
shay
  • 1,317
  • 4
  • 23
  • 35

1 Answers1

0

i think i got it

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

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

and when component focused i ask for

component.getFocusCycleRootAncestor() instance of PNL_A 

thanks

shay
  • 1,317
  • 4
  • 23
  • 35