You Are Here:

Community: Developer Discussion Boards

#1 Old Draw rotated text - 2008-09-04, 23:28

Join Date: May 2007
Posts: 15
Location: Cordoba, Argentina
Send a message via Skype™ to smabres
smabres's Avatar
smabres
Offline
Registered User
Hi everyone, I am Sergio from Argentina, I and writing a Business Intelligence module in J2ME, that I call BI Mobile, I am planning to do alerts list, pie chart, lines and bars charts horizontal and vertical.
I have finished Pie Chart it works fine, alerts list fine too, but while writing line charts I found that I need to draw 90 degrees rotates text for the X axis labels. Does eny one know how to g.drawString rotated?
Thanks so much for any help you can give me
Sergio


Sergio Mabres
Prominente S.A.
Argentina
Reply With Quote

#2 Old Re: Draw rotated text - 2008-09-05, 00:24

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Hi Sergio,

What you could do is this:
-Create a blank image
-Create an instance of that image's Graphics class (using getGraphics() method) and write the text on it using the drawString(...) method
-Show that image using the drawRegion(...) method, specifying the rotation parameter as, for example, Sprite.TRANS_ROT90

Here's the code I used for the canvas. You can adapt it to suit your needs.
Code:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.Sprite;

public class MyCanvas extends Canvas {
    
    public void paint(Graphics g) {
        String s="java";
        Image img=Image.createImage(50,50);
        Graphics gr=img.getGraphics();
        gr.drawString(s, 0, 0, Graphics.TOP|Graphics.LEFT);
        g.drawRegion(img, 0, 0, 50, 50, Sprite.TRANS_ROT90, 0, 0, Graphics.TOP|Graphics.LEFT);
    }
    
}
Reply With Quote

#3 Old Re: Draw rotated text - 2008-09-05, 14:51

Join Date: May 2007
Posts: 15
Location: Cordoba, Argentina
Send a message via Skype™ to smabres
smabres's Avatar
smabres
Offline
Registered User
Dear Bogdan thanks so much it is just what I needed; I have been programming for enterprise apps. for more than 20 year I never thought I was going to use a Sprite, your idea is great, I wish I could show you the Line Graph final image.
Thanks so mucho for your help
Sergio


Sergio Mabres
Prominente S.A.
Argentina
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Draw text on sprites/bitmaps... erst Symbian Media (Graphics & Sounds) 2 2007-05-16 16:05
How to draw text on the bitmap? Joney.Zhang Symbian Media (Graphics & Sounds) 1 2006-09-12 08:45
Persist text value of user defined option in Enumerated Text Settings List leethomso Symbian User Interface 0 2004-11-24 19:49
How to draw right align text? yingchuan Symbian 1 2004-10-23 03:05
How to draw a long text into multiline text?? titoliu General Symbian C++ 1 2002-08-09 12:15

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia