In this serious of J2ME tutorial, we are going to describe how to draw a triangle, rectangle, arc, line or a round rectangle in one small application. Although we have already explained you all these examples separately but in this section we are going to merge them in one. For that we have created a list of all the items that will be used to select the particular item to run. So here we are creating a implicit type list called CanvasDrawList and defined all the elements into it.
Now we need to use the canvas class to draw all the graphic or image. We can call the canvas class in our application through this syntax..
class CanvasDraw extends Canvas implements CommandListener
In this syntax you can see that we are creating a class called CanvasDraw which extends the canvas class through "extend" keyword.
The output of the application will look like as follow....
Source Code of CanvasDrawExample.java
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 19, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles