Find component with specific focus index

General questions regarding the development with JVx.

Find component with specific focus index

Postby jvxdev » Mon Mar 07, 2016 3:33 pm

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?
jvxdev
 
Posts: 19
Joined: Fri Mar 04, 2016 12:40 pm

Re: Find component with specific focus index

Postby Support@SIB » Mon Mar 07, 2016 3:36 pm

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.
User avatar
Support@SIB
 
Posts: 202
Joined: Mon Sep 28, 2009 1:56 pm


Return to Development