Adding Code
The Forms Designer helps you to create your initial form class and even provides much of the skeleton code for things like event handlers. However, at some point you need to actually write code to make your application do what you want it to.
Event handler methods are called when an event is triggered from a user-interface element on the form, such as a mouse click on a control. The Forms Designer creates skeleton code for these, so it's mostly a matter of filling in the code you want run when the event occurs. The WFC component model employs a new delegate keyword in the Visual J++ compiler that is the basis of all event handling. While delegates are transparent when using the Forms Designer to hook up handlers for events, they can be used directly for more advanced scenarios, such as sourcing your own events. Since they are essentially the same as a function pointer in other languages, they are useful in a number of ways.
In addition to controls and event handlers, there are many other parts of the WFC library that you will find useful.
-
Graphics support. Several classes in the com.ms.wfc.ui package, including the Graphics class, provide support for accessing Windows graphical services.
-
Dynamic HTML support. The com.ms.wfc.html package provides an extensive set of classes that provide access to the DHTML object model implemented by Internet Explorer (versions 4.0 and later).
-
Data binding support. WFC is designed to use the ActiveX Data Objects (ADO) components to support both simple and complex data binding. Using the DataBinder component, you can bind a field from a recordset to the property of any WFC component. WFC also provides other complex-bound components that interact directly with a recordset.
-
Localization support. WFC provides support for localizing your code much easier by letting you store your resource elements, such as strings, fonts, and bitmaps, in a resource file matching a specific international locale. This simplifies the job of translating user interfaces for multiple languages.
-
Direct Win32 API support. The J/Direct technology provided with Visual J++ enables you to call any dynamic-link library (DLL) from your Java code. WFC is built upon a layer of J/Direct calls to Win32 libraries (implemented in the com.ms.wfc.Win32 and com.ms.wfc.OLE32 packages). Consequently, if you are comfortable with standard Windows programming and want to access those libraries directly, WFC provides the underlying elements (such as device contexts and window handles) to give you ultimate control. While this may be desirable for some specialized applications, most programmers will find the basic services of WFC sufficient.