When Control Abstraction (maybe) does not fit...
Peter Levart
peter.levart at marand.si
Fri Jan 8 04:17:56 PST 2010
On Friday 08 January 2010 12:56:16 Gernot Neppert wrote:
> okButton.addActionListener(ActionEvent e:)
> {
> dialog.hide();
> }
>
> Does it look intuitive?
I think the syntax "skips" colon in this case:
okButton.addActionListener(ActionEvent e)
{
dialog.hide();
}
This would also work:
// synchronizing properties of two beans...
Bean1 bean1 = ...;
Bean2 bean2 = ...;
bean1.addPropertyChangeListener(PropertyChangeEvent e : "property1") {
bean2.setProperty2(e.getNewValue());
}
bean2.addPropertyChangeListener(PropertyChangeEvent e : "property2") {
bean1.setProperty1(e.getNewValue());
}
But since these are registration only methods, execution of controlled blocks is defered to a later time, possibly from some other thread.
One should keep that in mind and not try to return from method in the controlled blocks - this would trigger exception.
Peter
More information about the closures-dev
mailing list