Q:

How to use variables to refer to Components in codename one?

I created a UI with the UIBuilder.
Instead of always using the findXXXX (), I would love to do something like this in the Statemachine:
public class Statemachine ... {

private Container c;
private Tabs t;

initVars () {
   initAll();
}

....
private initAll () {
   Container c = findContainer();
   Tabs t = findTabs();
   ...
}

}
and use them as c.getYYY().
Is this possible? If yes, how?

A:

Yes you can do that, but not advisable.
The danger of it is when you have 2 components with the same name on different forms, this may reference wrong component and may be hard to debug.
If you sure can deal with the above, you can declare and initiate the variables inside Statemachine class but outside of all methods as a private global variable.
public class Statemachine ... {

    private Container c = findContainer();
    private Tabs t = findTabs(); 

    initVars () {

    }

    ....
}

