Sony Ericsson P900 Cell Phone User Manual


 
Developers Guideline UIQ C++ and PersonalJava
15 October 2004
It is recommended to install Sun J2SDK. When using the J2SDK, it is important to compile using a
pJava “classes.zip” file. Such a file can be found in the UIQ SDK. Also, the javac compiler directive “-
target 1.1” must be used for the J2SDK to assure that JDK 1.1.* compatible bytecode is generated. A
good example of this can be found on the Sun web page: http://java.sun.com/j2se/1.
5.0/docs/
tooldocs/windows/javac.html#crosscomp-example.
JavaCheck(tm) is a useful tool provided by Sun that helps you to find out if your source code conforms
to the pJava specification. See:
http://java.sun.com/products/personaljava/javacheck.html
You should use JavaCheck 3.0 which corresponds to the 1.1.x PJAE specification.
pJava performance
pJava is located on the A: drive in the P800 series. However, in the P900 and P910 series, pJava resides in
ROM (Z: drive) and 'executes in place'. This means that in the P900 and P910 series, the virtual machine
binaries and classes.zip are not copied to RAM before execution. This results in approximately 1 second
shorter startup time for an application and lower RAM usage per launched application.
pJava application considerations
The available screen size is 276x208 pixels and applications are usually based on the java.awt.Frame
class. A good rule to minimise the start-up of applications containing complex GUIs, is to instantiate all
GUI elements just before they are first needed, rather than at start-up. To give the user a perception of a
quick starting application, it may be a good idea to load and display a “splash screen” as the first action
while additional initialisation continues. This is something to consider for commercial grade applications
where this additional development work is well worth the effort.
pJava font limitations (java.awt.Font)
The fonts and font sizes available to pJava applications are limited by the native fonts available in Symbian
OS.
It is possible to obtain a list of the available fonts by using the java.awt.Toolkit class. The toolkit is acquired
by using:
java.awt.Tookit tk=java.awt.Toolkit.getDefaultToolkit();
You can now get a string array of available fonts by using:
String[]fonts = tk.getFontList();
Only a limited set of font sizes are available for each font. For pJava, not all font sizes that can be specified
in the font constructor are available. Instead the nearest smaller size available will be constructed. It is
possible to sense the actual size obtained by using the method:
FontMetrics fm = tk.getFontMetrics();