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
Contributor
Posts: 20
Registered: ‎03-03-2010
My Device: 8110
My Carrier: vodafone

How to use menu

Hi All,

I am new in Blackberry,

I want to use menu on canvas, how will i use menu on canvas?

I am using Blackberry JDE 4.7 for blackberry application development.

 

Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: How to use menu

The Canvas class is specific to the MIDlet MIDP framework. For menus, take a look at the Command class.

 

You can develop for the BlackBerry using the MIDlet MIDP framework or using the BlackBerry CLDC framework. You cannot mix the two frameworks in a single application. The BlackBerry framework provides more features, but is specific to BlackBerry devices. A MIDlet application will be easier to port to other devices. Most BlackBerry developers choose to use the BlackBerry framework.

 

For the BlackBerry framework, the equivalent to a Canvas is to write your own custom subclass of the Field class and add it to a MainScreen. Then take a look at the methods getContextMenu() and (for the screen) makeMenu().

 

For more information on MIDlet development, read the BlackBerry MIDlet Developer Guide.

 

For more information on BlackBerry development read the BlackBerry Development Guides, especially the Fundamentals Guide and the Getting Started Guide. (Be sure to select the 4.7 version of the documents.)




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Contributor
Posts: 20
Registered: ‎03-03-2010
My Device: 8110
My Carrier: vodafone

Re: How to use menu

okk..

thnx..

what i understand from your reply is that i have to devlop one class which extends Field class of blackberry API.

Can i use paint method in that class for developing UI part?

In J2me we use canvas's paint method for developing the UI part.

 

 

Developer
Posts: 141
Registered: ‎02-10-2010
My Device: 9500
My Carrier: Airtel

Re: How to use menu

Yes, You may override the paint method for the Field class. There are various derived classes too like MainScreen, PopupScreen, etc that provide different layout options/components. You may check and use as per your requirement.

 

If you only need a plain canvas, then Field class is the one you need.

Contributor
Posts: 20
Registered: ‎03-03-2010
My Device: 8110
My Carrier: vodafone

Re: How to use menu

[ Edited ]

okk..

I will try with plain canvas.

 

I have created one class which will extend Field

& in that class i have override the paint method in that methd i am trying to disply the text.

but it is not displying only blank screen is displaying.

 

I hvae added this subclass in the MainScreen object & i displyed that mainscreen objecct.

Is it the rigjht way??

Highlighted
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: How to use menu

After reading the API documentation for Field, I'd suggest doing a Google search for examples, using some or all of these terms:

 

blackberry custom field example tutorial game

You should be able to find several good step-by-step tutorials.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.