Internals of jwx!

1.  Welcome

Welcome to the beautiful world of jwx!, a Java binding to the wxWidgets framework. For more information about jwx! please see the README.

This text describes internals of jwx!. If you want to compile jwx! from the current development sources or contribute/customize the jwx!, please read it carefully.

2.  Prerequisite

To understand jwx! sources, you should feel comfortable with:
  • Core Java programming
  • Using SWIG for C/C++ to Java binding
  • GUI development using wxWidgets/wxPython
  • Bakefile Build system
To build jwx! from SVN sources, you need following tools/libraries:
  • wxWidgets 2.6.3
  • SWIG 1.3.31 (with rxspencer support)
  • Bakefile 0.2
  • Python 2.4
  • Bash, awk and coreutils
  • GCC 3.4, GNU Make and binutils
  • jdk 1.4 and Ant 1.6
  • A good source code editor like GVIM, eclipse
  • Subversion (SVN) client tool
Download and build SWIG-1.3.31 with rxspencer support. rxspencer can be obtained from or

3.  Directory Structure

Structure of top level directory:
  • bakefiles - contains bakefile scripts to generate Makefiles
  • docs - contains documentation
  • patches - contains patches (Unified format diffs)
  • samples - contains jwx! samples
  • sources - contains jwx! module projects
  • swig-gen - contains python scripts to generate SWIG interface definitions.
Structure of sources directory:
  • include/jwx - contains common C/C++ include files
  • core - contains Core module
  • ... - other modules
Each module sub project should be created in its own sub directory. For example `core` for the Core module.

Each module project should follow this structure:
  • java  - contains Java sources
  • swig  - contains SWIG interfaces and C/C++ helper code
See build.xml of Core module to create build.xml for new module.
See Core.bkl under bakefiles to create xyz.bkl for new module.
See Bakefile.bkgen under bakefiles to automate Makefile generation.

4.  Coding Style

Strictly follow the listed coding guidelines.


  • For Java code, follow Java coding style.
  • For C/C++, follow wxWidgets codding style.
  • For SWIG, follow same style as C/C++.

Tab settings:

  • Use four spaces instead of a tab char.
  • Use `sts=4 st=4 et` if you are using GVIM.

Java Specific:

  • Always use `wx` package.
  • If you need different package create a sub package, for example ``.
  • Write javadocs whenever possible.

C/C++ Specific:

  • Write portable code.
  • Keep declarations and implementation seperate.

SWIG Specific:

  • Keep common classes in single file if possible.
  • Strictly follow jwx! renaming rules. (See _renames.i)

Source code header:

  • Put header comments (See existing source code)
  • Set svn:keywords property having value `Id` (See SVN book for help)
If you are using GVIM, download swig-vim package from jwx! download page. This package provides syntax, indent and ftdetect scripts for Vim.

5.  SVN Access

To get current development sources from the SVN repository, do this
svn co jwx
If you want to update your copy of the sources, change to the jwx directory and do this...
svn update
Please see `SVN Book` for more information about svn usages.

6.  Compilation

  • If necessary, use `` under `bakefiles` to generate Makefiles.
  • Follow the same procedure as described in BUILD instructions.

7. Creating new Modules

TODO: How to create a minimal example module

Thank you.

- Amit G Mendapara <>