java - Getting tab index to remove tab component -


i'm trying building tab object close action , i'm thinking ways it. easiest (until think so) it's remove tab component through tab index like:

tabcomponent.remove(int index); 

but problem is, don't know how tab i'm focused on application (such returning focused tab int) , pass index continue close operation. found nothing problem researching on internet , know if else has opinion or idea solve this? in advance

use getselectedindex() find out open tab:

int index = tabcomponent.getselectedindex(); if (index != -1) {     tabcomponent.remove(index); } 

Comments