Page 1 of 1

Find component with specific focus index

PostPosted: Mon Mar 07, 2016 3:33 pm
by jvxdev
I want to find the component with a specific focus index. I set the focus index with

Code: Select all
component.setTabIndex(new Integer(2));

but I didn't find a method like

Code: Select all
findComponentByTabIndex(int);


How could I get a component by focus index?

Re: Find component with specific focus index

PostPosted: Mon Mar 07, 2016 3:36 pm
by Support@SIB
JVx doesn't offer a utility method for this, but it's no problem to implement this method:

Code: Select all
for (int i = 0, cnt = container.getComponentCount(); i < cnt; i++)
{
    Integer index = container.getComponent(i).getTabIndex();
   
    if (index != null && index.intValue() == 2)
    {
        //found
    }
}

The tab index is per container, so simply iterate the components of a container.