Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
yogeshlanjekar
Posts: 28
Registered: 07-10-2010
My Carrier: Vodafone

Draw Text in Blackberry 5.0

Hi all,

In my application for Blackberry 5.0, i want to draw text vertically along Y axis. Can any one help me out?

Please see the image below for refrence.

 

Thanks,

YoGi

 

9700.jpg

Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: Draw Text in Blackberry 5.0

good question, i checked some sources but have no clue how to do it.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Developer
peter_strange
Posts: 14,613
Registered: 07-14-2008

Re: Draw Text in Blackberry 5.0

I'm not up to the maths involved but RexDoug is, and he has posted a solution to your problem (as I understand it) here:

http://supportforums.blackberry.com/t5/Java-Development/drawText-along-non-horizontal-straight-line/...

 

Not sure if these help, I think they end up in the same place. 

 

http://supportforums.blackberry.com/t5/Java-Development/How-to-rotate-a-text-string/m-p/453880

http://supportforums.blackberry.com/t5/Java-Development/Text-at-an-angle/m-p/1159647

 

Please use plain text.
New Contributor
NitishSubudhi
Posts: 8
Registered: 12-09-2011
My Carrier: BlackBerry Developer

Re: Draw Text in Blackberry 5.0

[ Edited ]

use this code.....
i have use this code to display the text like you want

VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH)
{
protected void paint(Graphics graphics)
{
// graphics.drawBitmap(0, 0, 33, 138, dateImg_c, 0, 0);


{
int thetaFixed = Fixed32.toFP(90);

int cell_11 = Fixed32.cosd(thetaFixed);
int cell_12 = -Fixed32.sind(thetaFixed);

int cell_21 = Fixed32.sind(thetaFixed);
int cell_22 = Fixed32.cosd(thetaFixed);

int[] transform = new int[] { cell_11, cell_12, cell_21, cell_22, 0, 0 };

Font myFont = Font.getDefault().derive(Font.BOLD, 17, Ui.UNITS_px, Font.ANTIALIAS_STANDARD, 0, transform);
graphics.setFont(myFont);
graphics.setColor(Color.WHITE);
graphics.drawText("Vertical text drawn", X-position of text, Y-position of text);
}
super.paint(graphics);
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(X-position, Y-position);
setExtent(X-position, Y-position);
}
};

just manage your X-position and Y-position as you want

thanks and regards
Nitish Subudhi

Please use plain text.