Home · Examples 


Java User Interface Compiler (JUIC)

The Java User Interface Compiler (JUIC) command-line tool converts the Java user interface definition file (.jui) generated by Qt Designer to Java source files.

Usage

juic [option]... <.jui file>
Note that Qt Jambi also provides an Eclipse integration that includes JUIC, automatically running the tool whenever the .jui files change. In Eclipse, JUIC is integrated as a custom build tool which will be executed prior to the Eclipse built-in incremental builder meaning that all source code is ensured to be up to date after the Java user interface has been edited in Qt Designer.

See the Simple UI Example example documentation for details on how to implement Java user interfaces for applications, using .jui files.

Options

The following table lists the command-line options recognized by JUIC:
Option
Description
-h, -help Describes the usage and lists the command line options.
-v, -version Displays the compiler's version number.
-d <dir> Specifies the output directory.
-x <xml file> Load custom configuration file.
-p <package> Specifies a package for the generated .class file (relative to the output directory).
-cp <path> Updates all the .jui files in the given path.The path argument is optional; the default path is $CLASSPATH.
-pf <prefix> Specifies the the prefix used for the generated classes. JUIC automatically adds 'Ui_' prefix to the generated classes. Use this option to alter the prefix, omit the argument to remove the prefix.
-i <file1>:<...>:<fileX> Used in combination with the 'cp' option, making JUIC only update the specified files.
-e <file1>:<...>:<fileX> Used in combination with the 'cp' option, prohibiting JUIC from updating the specified files.
-a Updates the files regardless of modification date.

Compatibility with Qt .ui Files

Qt has for several years used .ui files to represent forms. These are generated with Qt Designer and converted to code using the uic tool. The .ui files are xml datastructures containing class names, properties and connections. Many of these are C++ specific, such as enum values for properties and signal signatures.

Up until the third technology preview, Qt Jambi also used this file format to represent forms created with Qt Designer. But with the beta release, Qt Jambi introduced a new file format for the Java user interfaces (with the extension .jui). This is done to add better support for custom widgets written in Java, widgets with signals and properties of their own. Note that the .jui XML data structure is based on Java syntax.

For compatibility reasons, the Qt Jambi generator provides an option to for convert a C++ .ui file into a Qt Jambi .jui file. This is done by running the generator with the --convert-to-jui=[uifile] option like this:

./generator qtmasterheaderfile.h jambimastertypesystem.txt
             --convert-to-jui=calculatorform.ui
This will convert the calculatorform.ui to calculatorform.jui based on the generator's default settings. Note that if the original user interface contains custom widgets, its type system and header file must be specified to the generator. Please see the
Qt Jambi Generator documentation for details.

If the original user interface contains promoted widgets, then the Java equivalents for these should first be added to the custom widgets specification for the Qt Jambi Designer (this can be done automatically using the Eclipse Integration or manually using a text editor) then the name(s) of these xml specifications should be passed to the generator on the command line:

./generator qtmasterheaderfile.h jambimastertypesystem.txt
             --convert-to-jui=calculatorform.ui
             --custom-widgets=../plugins/qtjambi/qtjambi_examples.xml
For more details on this, see Qt Jambi Generator documentation.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Jambi 4.5.2_01