开发者

how is the container component

开发者 https://www.devze.com 2022-12-30 19:46 出处:网络
i have an application with two main panel LEFT and RIGHT when a component got focus i want to know开发者_开发技巧

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消