I have @Action for example:
@Action
public void example(String name){
//sth to do
}
and I would like to add this method to button generated in netbeans. When I click to Customize Code and write:
myButton.setAction(example(myButton.getName()));
I’m getting error:
‘void’ type not allowed here.
Why I can’t do like this? :/ @Actions generated by netbeans are also return void.
myButton.setActionis a function which expects an argument.exampleis a function which does not return anything.myButton.setAction(example(...))passes the value returned by an invocation ofexample(...)tosetAction.Do you see why that’s a problem?