문제

I am building a json editor in codenameone. In my current design I need to insert or remove components that have focus when a menu command is pressed. So for instance if i have TextFields inside a Container , I need to determine which textfield has focus when I press the insert menu option so that I can insert another component there.

도움이 되었습니까?

해결책

On the current form (you can get the current form using Display.getInstance().getCurrent()) invoke getFocused(). You can also bind a focus listener using addFocusListener on the form or on the component you want to track.

Notice that with touch device the concept of focus isn't quite the same since focus isn't marked on such devices.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top