Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Testing and Deployment

New Contributor
Posts: 3
Registered: ‎08-09-2010
My Device: Not Specified

Problems painting the char J to canvas.

Hello All,


I am developing a JavaME MIDlet which is being ported to a Blackberry .COD file and have a strange bug showing up once the application is run in the simulator.


I am generating a random int between 64 and 91 which correspond to a char between A and Z, and then painting that char to a canvas. For some reason the code will not paint a J. All other char between A-Z paint correctly. Here is my code.


char _letter;

if (InokuUtils.isKeyboardPresent())  _letter = (char)(InokuUtils.getRandom(26)+65);
else   _letter = (char)(InokuUtils.getRandom(10)+48);


And then later

 g.drawChar(_letter, _posX , _posY  - g.getFont().getHeight()/2 ,
                        Graphics.TOP | Graphics.HCENTER );

It seams that the simulator draws a blank space in place of the J.


I have yet to deploy the application on a real world device, so I have no way to say if it is a simulator problem or not. The code works correctly in the Sun Java ME emulator.


This problem has confounded me for some time now and any suggestions would be appreciated.




BlackBerry Development Advisor
Posts: 15,814
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Problems painting the char J to canvas.

[ Edited ]

What BlackBerry Smartphone model and BlackBerry device software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.


What is the current font set to?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Contributor
Posts: 3
Registered: ‎08-09-2010
My Device: Not Specified

Re: Problems painting the char J to canvas.

Hello Mark thank you for responding.


As of yet I have not tested the application on a real-world device, only in the simulators.


I have run the app in the following simulators; 8300,8910, 9700-T-Mobile.


Will changing the default font on the phone effect the fonts created by MIDlets call to the JavaME Font class?


I have tested the MIDLet on a java phone and the code seems to work fine. It hard for me to say if this a porting issue, a simulator issue, or a code issue.


I do plan to test on a Blackberry device shortly, which should help determine where the glitch is happening.