Thanks, I'll switch to that, the description on the javadoc seemed to
imply they were supposed to be used as separate classes.

On Mon, Mar 29, 2010 at 12:00 PM, Greg Brown <[email protected]> wrote:
> In cases where I have used actions like this, I have generally created inner 
> classes that can see the WTKX-bound member variables of the outer class; e.g.:
>
> public class MyWindow extends Window implements Bindable {
>   �...@wtkx private TextInput input;
>
>    public class MyAction extends Action {
>       �...@override
>        public void perform() {
>            doSomething(input.getText());
>        }
>    }
> }
>
>
> On Mar 29, 2010, at 11:53 AM, Mike Smorul wrote:
>
>> I'm wondering, what is the 'best' way to provide form data to an
>> action. What I have been doing follows, first create an action class
>> that gets its input from some components.
>>
>> public class MyAction extends Action
>> {
>>     @WTKX private TextInput input
>>
>>   �...@override
>>    public void perform() {
>>        doSomething(input.getText());
>>    }
>> }
>>
>> When the program starts, I'm left adding the actions, then after
>> loading the wtkx file, then calling bind on my actions to load
>> components.
>>
>> NamedActionDictionary nd = Action.getNamedActions();
>>        nd.put("myAction", new MyAction());
>> ...
>> ...
>>
>> WTKXSerializer wtkxSerializer = new WTKXSerializer();
>> window = (Frame) wtkxSerializer.readObject(this, "mainWindow.wtkx");
>> for (String act : Action.getNamedActions())
>>        {
>>            wtkxSerializer.bind(Action.getNamedActions().get(act));
>>        }
>>
>> Is there a better way?
>>
>> Thanks,
>> -Mike
>
>

Reply via email to