Provides a means for extending UISpec4J to support user-defined components.
This class offers a main() function which generates a JAR file containing extended
versions of some UISpec4J classes (for instance
Panel ).
This JAR file is intended to be placed before the UISpec4J JAR in your classpath.
Arguments:
<path> <name:class> <name:class> ...
where:
<output> is the path of the JAR file to be generated
- each
<name:class> defines an extension, where:
name is the name of the component to be integrated
class is the name of the component class
For instance:
java -cp ... org.uispec4j.extension.ExtensionGenerator lib/uispec_ext.jar Calendar:com.xxx.Calendar
Note: When runnning this class, the UISpec4J and ASM JARs must be included in the classpath
(please refer to the
dependencies page for a list of specific JARs to be
used).
The component class and the associated Swing class must adhere to certain conventions:
- The Calendar class must implement
UIComponent (or better yet extend
AbstractUIComponent )
- The Calendar class must declare a static field TYPE_NAME providing the related type name
- The Calendar class must declare a static field SWING_CLASSES providing the related swing classes
- The Calendar class must provide one public constructor with a JCalendar parameter
- The JCalendar class must extend java.awt.Component
- The given name ("calendar") must not be already used within UISpec4J.
For instance:
public class Calendar extends AbstractUIComponent {
public static final String TYPE_NAME = "calendar";
public static final Class[] SWING_CLASSES = {JCalendar.class};
public Calendar(JCalendar calendar) {
...
}
}
See Also: Extending UISpec4J |