Back
Differences between DirectForms and Microsoft WinForms
Although main goal of DirectForms project is to develop Java GUI library
that resembles WinForms API, some differences are inevitable.
Major ones are:
-
Event handling. C# has language construct of delegates, which WinForms
uses to provide event handling capability. Because Java doesn't have similar
language construct, DirectForms uses technique that is employed by most of
Java GUI libraries. You can add and remove event handlers to specific event by
using methods addXXXHandler and removeXXXHandler. You can combine adding event handler
with creating instance of annonymous inner class to have more compact code.
-
Properties. Again, C# has language construct, which provides direct
support of properties. In place of properties, DirectForms uses getter and setter methods like
regular JavaBean class.
So instead of:
Text = "Hello World!";
like in C#, in DirectForms you need to:
setText("Hello World!");