The Java Generation Options Dialog allows you to control the following four areas associated with Java code generation:
Application or Applet
By default, X-Designer will generate an application from your design. If you prefer to generate an applet, select the appropriate option from the option menu. If you select "Applet", the generated main code file will contain extra code to allow the application to run inside an HTML browser.
Changing the Base Class
The main code file contains one class which, effectively, links together your design. The name of this class is whatever you have specified as the application class in the Code Options dialog (or XApplication by default). This can be extended from another class by typing its name in the text box labelled "Base class". If you are generating an application and you do not specify a base class, the application class is not extended. If you are generating an applet and you have not specified a base class, the Java class "Applet" is used by default.
Generating Code for a specific version
This option allows you to select between Java 1.0.x, Java 1.1, Java 1.2/3 (Swing), and Java 1.4 (Swing) code generation. Whichever version was last selected is the version used when code is generated from the command line. If no selection has been made, the default of "Java 1.2/3" is used.
Using GIFs
The GIF options section of the dialog takes on one of two forms, depending on whether you are generating an application or an applet. in both cases, there is a toggle labelled `Use GIFs' at the top of the section. If this toggle is not selected, the rest of the section is insensitive. When it is selected and you are generating an application, the code generated for pixmap objects assumes that all of the pixmaps are stored in separate GIF file. When the "Use GIFs" toggle is not set, the pixmap objects are stored in a file named ApplicationClassNamePixmapObjects.java as arrays of integers. When the "Use GIFs" toggle is set, that file contains code to load the GIF files. Also in this case, an extra file is added to the list of Java code files. This is the property file and is named ApplicationClassNameProperties. In this file, the GIFs are referenced as follows:
ApplicationClassName.ApplicationImagesName.PixmapObjectNamewhere "ApplicationImagesName" is the value entered into the text field in the GIFs options section of this dialog. For example, if you are using the default application class name, XApplication, and you have created a pixmap object named "TreeIcon" and you have entered the value "MyApplicationImages" into the text field, then the property name for the TreeIcon pixmap would be:
XApplication.MyApplicationImages.TreeIconand if you had another pixmap object, this time named "LeafIcon", the property name would be:
XApplication.MyApplicationImages.LeafIcon
If you are generating an applet and you have set the "Use GIFs" toggle, the GIFs section of the dialog contains a text box which allows you to specify a directory (relative to the document base) where the GIF images can be found.
If you wish to use GIFs in your application or applet, you will need to create the GIF files. X-Designer provides some help by allowing you to generate XPM files for all your pixmap objects in one go. To do this, go to the "Pixmaps" page of the Generate Dialog. This contains a list of the pixmap objects in your design. Pressing "Generate" creates a XPM file for each object giving it the name PixmapObjectName.xpm. You can choose whether you wish to generate XPM2 or XPM3 format. Once you have generated the XPM files, convert them to GIF files using the conversion utility programs from the pbm library, which is distributed with UNIX.
Specifying a Package
The last section of the Java Generation Options Dialog contains a text area where you can specify the name of a package. A package is a group of classes that are bundled together. If you choose to generate your classes as a package, your main code file will contain a statement to import it.
Note - There are some conventions which should be followed in the naming and organizing of packages. Your Java documentation will have more details on this.
See also: