01-31-2011 04:25 AM
I am very sorry for posting this twice, but I think that the subject of my old post was misleading and I could not change it anymore. Old Thread: (http://supportforums.blackberry.com/t5/Java-Develo
Is there a way to rotate the whole Screen?
I am programming a Midlet for the Bold and the Storm 2. My Midlet has the following Dimensions:
Width 360, height 480;
It works fine on the Storm 2, but I want to rotate it on the bold (becaus its screens width is 480, height is 360) so that the user needs to hold the device sideways (Screen on the left, keyboard on the right).
To demonstrate what I want, here is a little Graphic:
Any help is appreciated! Even a 'this is not possible' would help
Thanks in advance,
Solved! Go to Solution.
01-31-2011 07:07 AM
Thank you for your answer - I hope you aren't right :-p (but after all the research I already did, i'm also starting to believe that there is no simple function - which is stupid, because the OS itself does have such a method for devices which can be used in portrait or landscape mode, like the storm 2)
Just to clarify: I do not use any UIComponents; I use the GameCanvas of the J2ME implementation.
Any futher Ideas or suggestions from other people?
01-31-2011 08:29 AM
I don't know anything about Midlet UI processing. But if I was painting onto a Bitmap, which is a bit like a Canvas from what I understand, by swapping x & y round you can 'rotate' images. So it might be easy for you to do it yourself.
02-02-2011 05:34 AM - edited 02-02-2011 08:28 AM
Yes, that was what I tried to avoid, because I need to rotate the text as well and 'drawStrings' cannot be rotated (so easily); I was hoping to get an answer like 'yes just use this method and you're done' - but as it was already such a hassle to program for the blackberry (before posting this) it does not make me wonder that it is not that simple.
What I did now is:
- I wrote a method, which replaces the Image.createImage(imgString) to rotate my images if a flag (displayIsRotated) is set
- For the two Versions I have different paint Methods which swap the X and Y Values (could have done this with a flag or extra Method, but two paint Methods are OK for me)
- The Strings: This was the most annoying thing. as g.drawString() is not able to draw the Strings rotated, I implemented a BitmapFont-Class (from http://devlinslab.blogspot.com/2007/11/using-custo
02-02-2011 06:30 AM
I have errors using both links in your Post - any chance you can add them again?
With respect to drawing text, one option that I didn't describe to you, was the option of painting the text into a Bitmap, then rotating the Bitmap. This is relatively easy to to do.
To do this, create a Graphics object, based on the Bitmap, drawtext using the graphics object, then you can rotate that Bitmap..
Might be easier than trying to format your own font.
02-02-2011 08:35 AM
Sorry about the links, the Forum made them clickable and added a ')' after the 'html'; I edited and tested them.
About painting the text into a mutable Image
I did try this before starting to implement the BitmapFont-Thing, but I need the Background of the Bitmap to be transparent so that I would have needed to copy each pixel from my Background Bitmap onto the Fonts-Image, because alpha transparency is not available in the MIDlet implementation;
It is also better to use BitmapFonts because the Bolds smalles font is bigger than the Storm2s one, so that this would have been another issue to solve;
I'm happy now with my implementation, mentioned above. :-)