I'm going to answer myself, after researching the issue, if anyone is interested:
In Apache Pivot there is no control called "toggle button" as such. Instead of this, i can use the control called "button".
In my case, "BotonGenerico" can transformed in ToggleButton, only changing the toggleButton property via setToggleButton:
BotonGenerico.setToggleButton(true);
After this, I can view or change it state, via getState and setState:
BotonGenerico.setState(State.SELECTED);
BotonGenerico.getState();
//State can be State.SELECTED, State.UNSELECTED or State.MIXED
On many cases, we have to work with 'components', instead 'pushbuttons' (p.e. in some events as mouseMove, mouseOut. focusedChanged...). Casting that mentioned 'component' to button, is simply to manipulate.
Sample:
//Changes PushButton background color when focus changed
@Override
public void focusedChanged(Component component, Component obverseComponent) {
//casting component and obverseComponent in order to convert it in PushButtons
PushButton botonComponent=(PushButton) component;
PushButton botonObverseComponent=(PushButton) obverseComponent;
if (botonComponent.isToggleButton()) {
if (botonComponent.getState() != State.SELECTED) {
System.out.println("Selected");
botonComponent.getStyles().put("backgroundColor", #000000);
}
}
}
Hope this helps.