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
Regular Contributor
Posts: 61
Registered: ‎03-28-2010
My Device: Bold 9700
My Carrier: Maxis Malaysia
Accepted Solution

using drawOval and drawLine

Hi,

 

I have this code from Java

 

        gc.drawOval(10,10,50,50);        
        gc.drawLine(10 + 25, 10+25, 10+25, 10);

 

which will draw Oval and draw a straight line in the oval. The original code is using canvas. I don't need to do anything fancy, just a screen that draw this oval and a line inside it. I have no clue on how to achieve this on bb.

 

How should i translate this into BlackBerry?

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: using drawOval and drawLine

[ Edited ]

drawOval(10,10,50,50)->drawArc(10,10,50,50,0,360).

drawLine stays the same.

 

Simple as that, works for MIDLets and RIMlets.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Regular Contributor
Posts: 61
Registered: ‎03-28-2010
My Device: Bold 9700
My Carrier: Maxis Malaysia

Re: using drawOval and drawLine

Thank you rcmaniac25!

 

What library should I import? Is there any working example that I can refer to?

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: using drawOval and drawLine

You can use either "javax.microedition.lcdui.Graphics" or "net.rim.device.api.ui.Graphics", both will work. If that was all you needed then mark the thread as solved.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.