• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating a red color ring in canvas

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to create a red colour ring in the canvas.Please reply me.I want the codes.Please Take this as a request.

Thanks in advance
 
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. You ought to take a look at: The Naming Convention

Please reply me.I want the codes


Umm...

Take this as a request


Ok. Done.

Anyways, onto your request. What kind of ring to you want? An image, or
just a drawn circle? Please me more specific.

For information about the Graphics class in J2ME, take a look at: http://www.kickjava.com/3204.htm


/Svend Rost
 
Michael
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for replying me.I want a red colour ring not an image.
Its is like white coloured small circle inside an big red circle and background of the canvas is white.So it looks like a red coloured ring.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, well, it sounds like you're on the right track, conceptually. What have you got so far? Does your app create the canvas okay? Can you have it draw anything on the canvas?

Assuming that you've gotten that far, the next steps are:

1) Set the drawing color to red. Use the setColor() method of the Graphics class for this.

2) Draw your large circle whereever you want. Use fillArc() method of the Graphics class for this.

3) Set the color to white.

4) Draw your small circle. You'll probably need to experiment a bit with different x/y offset values to get it to look the way you want.

- Jeff
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Michael"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Michael
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the following codes for big red circle.
{
g.setColor(0xFFFFFF);

g.fillRect(0,0,getWidth(),getHeight());
int diameter=getWidth()/2;
g.setColor(color);
g.fillArc(diameter/2,diameter/2,diameter,diameter,0,360);
g.setColor(0x000000);
g.drawString(getNameFromProfile(),getWidth()/2,getWidth()/2,Graphics.HCENTER|Graphics.TOP);
}

I want the parameters for g.fillArc of the new small white circle.I tried different parameters.But i didn't got it correct.Can u plz try for me.
Thanks.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael, please read my previous post and change your display name.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic