subclasses of Canvas to scale their graphics in order to fit their contents
within the display area. Applications that support dynamic orientation
switching also need to consider where the soft keys are located on the
device. Once the orientation is switched, the keys have also moved and
the user might not be able to use them properly.
4.9 A Last Resort: NetBeans Preprocessing
When there are no other options, consider NetBeans preprocessing. It
is far from being the best solution but it is a technological solution that
would not exist if there was no engineering need for it.
The NetBeans device fragmentation solution is based on the use of
project configurations. A project should have one project configuration
for each distribution JAR and JAD that you would like created for that
project. The second part of the device fragmentation solution is the ability
to specify certain blocks of code in your source files as being specific
to one or more configurations. This is accomplished by using actions in
the right-click context menu of the editor, or from the Edit, Preprocessor
Preprocessing modifies the code in your source files before the code
is parsed by the compiler. The preprocessor modifies the code according
to directives inserted as code blocks into the code. These code blocks
are marked visually in the NetBeans Source Editor and are included (or
excluded) when you build the JAR for a specific project configuration or
ability. You can use these code blocks to create, manage and track code
that is specific to one or more project configurations or abilities.
For example, if you are writing an application targeted for several
different devices, you can create a project configuration for each device
(e.g., S60, UIQ), and a preprocessor block with directives for each project
configuration. You can then test the application for each device quickly
by changing the active project configuration and running the application.
It is not a recommended solution. You can choose it if there is no
Any discussion about Java ME is incomplete without referring to the issue
of fragmentation. And no discussion about fragmentation can enumerate
a comprehensive list of all issues and all solutions.
We discussed various approaches to deal with fragmentation, covered
some areas that tend to be diverse on Symbian OS and suggested
some possible solutions. You can use the solutions, generalize them,