Sample program to draw a arc in J2ME

By: Tamil Selvan Emailed: 1603 times Printed: 2075 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The Graphics class also supports the drawing of arcs. To draw an arc, you must specify six parameters. These parameters are the four quantities that define the arc's bounding rectangle, its start angle, and its end angle. The bounding rectangle is defined by the same four parameters required for rectangles.

The drawing routine traces the arc along a path from the start angle to the end angle in a counterclockwise direction. Angle 0 degrees is along the positive x-axis of the coordinate plane. Like other geometric figures, arcs can be drawn in outline mode or fill mode. Arcs can be drawn in outline or in filled form, like rectangles.

import javax.microedition.lcdui.*;
/**
Demonstrates the drawing of arcs using the Graphics
class.
@see javax.microedition.lcdui.Graphics
*/
public class ArcDemo extends Canvas implements CommandListener
{
...
public void paint(Graphics g)
{
paintClipRect(g);
int width = getWidth();
int height = getHeight();
g.drawArc(5, 5, 80, 40, 90, 300);
g.fillArc(5, 60, 80, 40, 0, 250);
}
...
}

Notice that the second arc is filled and that it was created using the fillArc() method instead of the drawArc() method.


J2ME Home | All J2ME Tutorials | Latest J2ME Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Tamil Selvan
Inner Class Example in Java
PreparedStatement Example in Java
UNIX read and write system calls sample program in C
Pointer Arrays and Pointers to Pointers in C
Relational and Logical Operators in C
Arithmetic Operators in C
strlen() sample program in C++
Sample program to draw a arc in J2ME
What Java Has Removed from C++
FileReader and FileWriter example program in Java

More Tutorials in J2ME
Code sample to Send SMS from a J2ME application.
Adding your own Application icon for your J2ME application (jar file)
Play a multimedia file in J2ME Program (Audio/Video) using MMAPI
Datagrams in J2ME (UDP Programming sample)
Client Server in J2ME (Socket Programming sample)
Using HttpConnection in J2ME (Retrieve web content from a website to a phone)
Using HTTP vs UDP vs Socket in J2ME
RMSCookieConnector - Using Cookies in J2ME
POST UTF-8 encoded data to the server in J2ME
lists, forms, choices, gauges, text fields, text boxes in J2ME
Using List to create a Menu and Menu items in J2ME
Using alerts and tickers in J2ME
J2ME Canvas sample to show games programming in J2ME
Timer and TimerTask example in J2ME
List of GPRS Access points for all countries

More Latest News
Most Viewed Articles (in J2ME )
GUI components and menu based J2ME Applications.
'LINK.EXE' is not recognized as an internal or ext
Code sample to Send SMS from a J2ME application.
What is J2ME?
Your first J2ME program and a midlet lifecycle explained.
RMS Basics in J2ME
List of GPRS Access points for all countries
Y.S. Sun Green Building Research Center
Sample J2ME code that shows various functionality of RMS.
A sample J2ME midlet that shows an example of using a Timer and a TimerTask.
Gauge sample program in J2ME
Sample program to draw a arc in J2ME
The MIDP Networking Model in J2ME
Using List to create a Menu and Menu items in J2ME
RMSCookieConnector - Using Cookies in J2ME
Most Emailed Articles (in J2ME)
Using HttpConnection in J2ME (Retrieve web content from a website to a phone)
What is J2ME?
DateField sample program in J2ME
Gauge sample program in J2ME
RMS Basics in J2ME
Y.S. Sun Green Building Research Center
Play a multimedia file in J2ME Program (Audio/Video) using MMAPI
Code sample to Send SMS from a J2ME application.
Download a file over a network in J2ME midlet
How to load J2ME applications to the IDEN handsets
Sample Java program shows how to Read a file over a network using J2ME midlet
Sample J2ME code that shows various functionality of RMS.
GUI components and menu based J2ME Applications.
java.lang.SecurityException: MIDP lifecycle does not support system exit.
Ticker sample program in J2ME