Valid XHTML 1.0 Transitional

The DictionaryForMIDs-Creator Developper's Documentation


DictionaryForMIDs-Creator (DfM-Creator)


Main Layer: Provides access to the other DictionaryForMIDs tools through the DfM-Creator GUI.






This layer contains the user interface.

DictdToDictionaryForMIDs converts an input dictionary file that is in the Dict protocol format (Dictd) into a single Comma-Separated-Value (CSV file) that is the input dictionary file for DictionaryGeneration.

DictionaryGeneration reads the input CSV file along with the file to generate dictionary files, index files and searchlist files in the DictionaryForMIDs format.

BitmapFontGenerator is used to generate bitmap fonts for mobiles devices that may not support some character encodings or other language characters like the chinese characters for instance.

JarCreator assembles all the necessary files in order for you to have a DictionaryForMIDs midlet. It then packs them in some empty DfM.jar/jad files.


This layer contains functionalities for the DictionaryForMIDs tools.

Source code overview


Overview of the packages

Package Description

Contains the class files for DictionaryForMIDs-Creator


Contains the string/translation bundle files


Contains the class files for DictdToDictionaryForMIDs


Contains the class files for DictionaryGeneration


Contains the DictionaryUpdate class files


Contains the BitmapFontGenerator class files


Contains the class files for JarCreator


Contains the single class (I18n) that handles
the application language/translation


Contains the sources for JDictd that are used by
DictdToDictionaryForMIDs to convert a Dictd dictionary
file into a comma-separated-value (CSV) file


Contains the sources for JDictd that are used by
DictdToDictionaryForMIDs to convert a Dictd dictionary
file into a comma-separated-value (CSV) file

Contains the sources for JDictd that are used by
DictdToDictionaryForMIDs to convert a Dictd dictionary
file into a comma-separated-value (CSV) file

Overview of the classes

Java Class Function

Pop-up window that shows some information about
DictionaryForMIDs-Creator, license information,
copyright notice...


Provides a GUI to enable the user to check
the integrity of a CSV file (the output file of


Helps in creating the languageXContentNN properties.
The creation is done graphically. This window is
launched from the PropertiesEditor window.


Contains the personalized exceptions for DfM-Creator.


This is the main class, the main window. Almost
everything is done in here. This calls all the other
windows, subroutines...


This is an interface not a class. Contains
the conversion steps for DictdToDictionaryForMIDs.
This does not do much of a job, will probably be
removed in a future version.


A window that displays help files for DfM-Creator.


A small text input dialog that is used by
PropertiesEditor to retrieve custom information.


The preferences window for DfM-Creator.


The PropertiesEditor window. This makes it
easier to create a file
that is used by DictionaryGeneration to generate the
dictionary files. The creation is also done graphically.


Previews the values entered/selected in the
PropertiesEditor window before saving them in the
final file. Can also
edit the values manually before saving them.


Regular expression utilities that are used to
check if the property infoText that is entered in the
PropertiesEditor contains an email address or a URL for
the dictionary. As of version 0.4 of DfM-Creator, this does
not always work. Will be fixed in a future version.


BitmapFontGeneration Preferences Summary Window.
A window that displays the summary of the font generation
preferences (values entered/selected by the user).


DictdToDictionaryForMIDs Preferences Summary Window.
A window that displays the summary of the dictionary conversion
preferences (values entered/selected by the user).


DictionaryGeneration Preferences Summary Window.
A window that displays the summary of the dictionary generation
preferences (values entered/selected by the user).


JarCreator Preferences Summary Window.
A window that displays the summary of the jar creation
preferences (values entered/selected by the user).

Important subroutines

DfMCreatorMain (the main window that holds the other tabs)

The font generator tab holds the FontToolkit created by Sean Kernohan. When i started creating the DfM-Creator, i did not want to have to write a new GUI from scratch for the BitmapFontGenerator. So, i decided to modify the FontToolkit and integrate it in the DfM-Creator. The code in this subroutine does what is necessary to get the FontToolkit to work with the DfM-Creator. The other modifications were done directly in the FontToolkit sources.

getFile() shows a file chooser to let the user choose a file and return the it's path.
Parameter: dirsOnly; a boolean value that toggles on/off the possibility of chowing directories only or files and directories.

trim() removes trailing slashes or backslashes at the end of a string. It is used here mainly to trim trailing slashes/backslashes from the paths to the input and output files and directories provided by the user. Works for both Windows and Linux (i.e, for \ and /).

printAnyMsg() prints a JOptionPane message dialog.
The parameters are the following:

setTheLocale() gets and sets the default locale. It can also test other locales during debug sessions for example.

savePreferences() saves the preferences (for now, only the look and feel preferences are concerned.)

applyPreferences() applies the saved preferences at program startup.

OwnTextFieldCheck() and OwnEncTextFieldCheck() check if the "Choose Your Own" radio buttons in the DictdToDictionaryForMIDs tab are selected in order to enable/disable the little text areas that let the user provide her own choices instead of the ones given by default. These radio buttons exist for encoding and separator character choices.

setDictdToDfMVals() checks the validity of the values entered by the user and passes them to DictdToDictionaryForMIDs if they are valid.
Exceptions thrown by this subroutine:

setDictGenVals() checks and sets the values up for DictionaryGeneration.
Exceptions thrown by this subroutine:

setJCVals() checks and sets the values up for JarCreator.
Exceptions thrown by this subroutine:

this subroutine does all the required operations in order for us to be able to convert a dictd dictionary file with DictdToDictionaryForMIDs.

this subroutine is like the above mentioned one, but it is proper to DictionaryGeneration.

this subroutine is like the above mentioned ones, but it is proper to DictionaryGeneration.

PropertiesEditor window

Shows an input dialog and returns its content.
Parameter: winTitle; the title of the window. Returns: the value entered by the user.

Processes the selected item of one of the four separator character ComboBoxes and returns the actual separator character corresponding to the selected item.
Parameter: combobox Returns: value; the selected separator character

shows some extra information about the properties.

launches a file open dialog in order to let the user choose a file that she wishes to edit and then launches the PropertiesPreview window. The user can then edit the file manually and then save it.

launches the PropertiesPreview window with the values selected/entered by the user in the PropertiesEditor. Here also the user can edit the file manually before saving it. Note that the name of the file is automatically set by the PropertiesPreview and is

shows a sample file.

validates the values entered by the user in the PropertiesEditor. Checks if the required values are all provided, if some TextFields are empty or not and so forth.

sets the values entered/selected by the user in the PropertiesPreview window.

updates/shows/hides some values/TextFields/CheckBoxes etc. according to the number of languages selected in the numOfLangCmbBox ComboBox.

shows the InputDialog window.
Parameter: label Parameter: winTitle Returns: String S

shows the ContentProperties-Creator window.

checks the content of the InfoText TextField to match it against the regular expression patterns present in the RegexpUtils class in order to make sure the user provided a URL or an email address for the maintainer(s) of the dictionary file that is about to be set up in the empty DictionaryForMIDs.jar/jad files.
Throws: IllegalArgumentException if the text does not contain an URL or an email address.

ContentProperties-Creator window

This subroutine updates (shows or hides some components) the ContentProperties-Creator's window according to the number of content declaration chosen for a particular language.

This converts the selected item's name of the color ComboBoxes into a RGB color code and returns it.
Parameter: comboBox, the ComboBox that is passed, from which the selected item's name will be converted into a RGB color code.
Returns: the String colorCode

This saves the content settings that were chosen by the user into the content variables located as public static variables in the PropertiesEditor Class.

class Task extends SwingWorker This SwingWorker Task class creates a fake progress bar which will give to the user the impression that the values are saved in a few seconds... In reality it takes less than a second for the values to be saved. This progress bar reassures the user and shows her that the values are really being saved and she can experience this visually. Of course the values are saved but it happens so quickly that without this progress bar, the user might have the impression that nothing is happening.

Preferences window

For the time being, the Preferences window offers the possibility to customize only the Look and Feel settings. It enables the user to select which look and feel should the DictionaryForMIDs-Creator have. The list that is displayed, varies from one operating system to another but whatever the operating system, if you installed JDK-7u2 or later, you should have the Nimbus, the Metal and the CDE/Motif look and feels installed. Note that to compile/build the DictionaryForMIDs-Creator you need JDK-7u2 or later.

In the List that displays the intalled look and feels, the values are displayed as follows by this code snipet that was copied:

// add the look and feel names to
// the list that the user will see

// add the actual class names to the
// array list that will be used to
// actually set the selected L & F
In fact, the order of the index in the list from which the user selects among the installed look and feels (info.getName()) is the same as the index order of the arraylist lookAndFeelClassNames; consequently, we use info.getName to get the names of the look and feels (names are better than the ugly class names), and then we use the actual class names that were stored in the arraylist lookAndFeelClassNames to pass them to the subroutine savePreferences() in order for it to save them.


Main subroutine that checks the integrity of a CSV file entered by the user. it calls the subroutine below to do the actual checking.

Copied from DictionaryGeneration in order to adapt it to DfM-Creator. Checks a CSV file's integrity.
Parameter: csvFileName the input csv-file's name.
Exceptions: DictionaryException, IOException


validateURL() checks if a string contains a URL, URI, URN.
Parameter: input the input string
Returns: true or false
Throws: Exception

validateEmail() checks if a string contains an email address.
Parameter: input the input string
Returns: true or false
Throws: Exception

Summary windows

  1. DictdToDictionaryForMIDs preferences summary window:

    fillDictdConvSummaryTextPane() gets all the needed information
    and formats them correctly so as to have a clear and neat
    summary of the Bitmap Font Generation preferences entered
    by the user.

    deleteCSVFile() is used to delete the incomplete output csv file if the conversion process is aborted by the user.

    class Task extends SwingWorker
    SwinWorker class named Task that is used to actually launch the dictionary conversion process in a new thread.
    In the DictionaryForMIDs-Creator, almost all SwingWorker classes are called Task, however, they do not belong to the same classes and therefore do not do the same things. We could have used just about any valid variable/class name instead of Task.

  2. DictionaryGeneration preferences summary window:

    Does the same thing as the above mentioned summary subroutine but for DictionaryGeneration.

    class Task extends SwingWorker
    SwingWorker class named Task that is to DictionaryGeneration what the above mentioned Task class is to DictdToDictionaryForMIDs.

  3. JarCreator preferences summary window:

    Does the same thing as the above mentioned summary subroutines but for JarCreator

    class Task extends SwingWorker
    SwingWorker class named Task that is to JarCreator what the above mentioned Task class is to DictionaryGeneration.

  4. BitmapFontGeneration preferences summary window:

    Does the same thing as the above mentioned summary subroutines but for BitmapFontGeneration

    Though the BitmapFontGeneration also has a preferences summary window, it does not have a SwingWorker class that handles the font generation process. The FontToolkit class already has a thread class that does for the BitmapFontGenerator, what the SwingWorker classes do for DictdToDictionaryForMIDs, DictionaryGeneration and JarCreator.

Subroutines that call the other windows

showPrefsWin() shows the preferences window.

showHelpWindow() shows the help window.

showAbout() shows the about window.

showPropWin() shows the PropertiesEditor Window.

showCSVFileCheckWin() shows the csvfile check window.

Getting the source code

You can download the current source code either from the Subversion repository or from this web site as a zip file.

Downloading the Source Code from SVN

The sources for DictionaryForMIDs-Creator are maintained in SourceForge SVN repository. Read the description on how to access the DictionaryForMIDs SVN repository.
You can also use the  "Download GNU tarball" link on the subversion web frontend to download the DictionaryForMIDs-Creator sources.

Downloading the Source Code as ZIP file

A zip file containing a stable release of DfM-Creator is available on this web site. Please bear in mind that this zip file contains sometimes sources that are outdated. If you want to get the latest development sources, always go to the subversion repository. To check out the repository, code:
svn co dictionarymid

Download the latest stable sources on this page

Note that these are only the DfM-Creator sources. For development purposes you will need some other tools/applications that are dependencies to DfM-Creator. To get all the dependencies, download at least the trunk directory from the subversion repository. To download only the trunk repository, code:
svn co dictionarymid_trunk

Building the tools and applications

Dependencies between the tools and applications

The following dependencies exist between the tools and applications:

Building the tools and applications with build.xml

Due to the complexity of DictionaryForMIDs-Creator, the only supported build method is through the use of the build.xml file that in under the directory trunk/Build.
You must have Apache-Ant and Antenna (preferably the latest versions).
Antenna is already present in the above mentioned build directory.

Before proceeding to the build, you must:

Important note: the source files are UTF-8 encoded. If you are using the old Sun WTK (for versions <= 2.5.2), you must set in the file (found somewhere under wtklib) the following property:

Written by Karim Mahamane,
Author of DfM-Creator.
Inspired by this file
written by Gert Nuber,
creator of DictionaryForMIDs.