Welcome!

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

Java Development

Reply
New Developer
jian
Posts: 33
Registered: ‎08-29-2008
My Device: Not Specified

How to show the title of a canvas in a MIDlet application?

How to show the title of a canvas in a MIDlet application? setTitle("myTitle") works on Nokia, Motorola phones but not on BlackBerry device.

Please use plain text.
Developer
acowart
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: How to show the title of a canvas in a MIDlet application?

Canvases don't seem to display the title bar, although forms do.

 

When I ran into the same issue, the best solution I found was to draw the title myself, although there may be a better way.

 

 

if (getTitle() != null){ //Closest font I could find to the title font Font f = Font.getFont( Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_SMALL ); graphics.setFont( f ); graphics.setColor( 0x000000 ); graphics.drawString( getTitle(), 2, 0, Graphics.LEFT | Graphics.TOP ); graphics.drawLine( 0, graphics.getFont().getHeight() + 1, getWidth(), graphics.getFont().getHeight() + 1 ); verticalPositionStart = verticalPositionStart + f.getHeight() + 2; }

 

 

Andrew Cowart | Metova
www.metova.com
Please use plain text.