Microsoft KB Archive/168943
INFO: Frequently Ask Questions for AFC
Last reviewed: July 29, 1998
The information in this article applies to:
This article covers some of the most Frequently Asked Questions (FAQ) about the Microsoft Application Foundation Classes, AFC.
For other Java related FAQs search the Web at http://support.microsoft.com/support for 'JAVA' and 'FAQ'.
Q. 1. How can I create a scrollable edit control in AFC?
A. In AFC all scrolling is performed using viewers. You can place an UIEdit control inside of a UIScrollViewer to get autoscrolling behavior. If you are placing the UIScrollViewer in a free-flowing layout manager, you should override the UIScrollViewer's getPreferredSize() and getMinimumSize() methods. If you are implementing a single line edit control, use the UIScroll.NOSHOW style and UIDrawText.setSingleLine() method.
Q. 2. How can I use an AWT control in my AFC program?
A. The UIAwtHost class enables AWT-based components to be used in AFC containers. For an example of how to host an AWT component, please see the SDK for Java 2.0x documentation for com.ms.ui.UIAwtHost and the AFC article titled "Introduction to AFC."
Q. 3. How can I use an AFC control in my AWT program?
A. The AwtUIHost class enables AFC-based components to be used in AWT containers. The constructor of AwtUIHost takes the IUIComponent to host in the AWT container. AFC also includes the AWT compatibility classes. For more information please see the SDK for Java 2.0x AFC article titled "Introduction to AFC."
Q. 4. How can I convert my AWT application into an AFC application?
A. The SDK for Java 2.0x includes a tool called AWT2AFC. This tool parses Java source code and determines what changes are necessary to convert the source to use the Application Foundation Classes (AFC).
Q. 5. How can script in my HTML page call into an AFC applet?
A. When writing an AFC applet, you must derive a class from AwtUIApplet and also from UIApplet. Your scripting code only has access to your AwtUIApplet derived class. Please see the SDK for Java 2.0x AFC article titled "Introduction to AFC" for an example of how to allow scripting code access to your UIApplet derived class. This is demonstrated in the AFCSkeleton section, where the getInfo() method is exposed.
Q. 6. Why does my paint() method never gets called in my UICanvas derived class?
A. In AFC the paint method takes com.ms.fx.FxGraphics as a parameter, not java.awt.Graphics. If you write a paint method that takes a java.awt.Graphics object your program will compile, but this method will never get called. The proper function signature is "public void paint(FxGraphics g)". For more information see the SDK for Java 2.0x documentation for com.ms.ui.UIComponent.
Q. 7. If I am targeting AFC102.ZIP, can I still use the 1.1 event delegation model?
A. You can use the JDK 1.1 event model in AFC 1.02, provided you remain within AFC. The com.ms.ui.event.* package has been implemented in JDK 1.02- compatible AFC. This implementation relies on the VM firing events, so a JDK1.02 event must exist for it to be implemented in an AFC listener.
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:
(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Rafael M. Munoz, Microsoft Corporation
Keywords : kbusage AWTPkg JVM kbfaq Technology : kbInetDev Platform : WINDOWS Issue type : kbinfo
Last reviewed: July 29, 1998