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
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell
Accepted Solution

large bitmap image scrolling problem

Quote from the previous forums:


Guest: guest
large bitmap image scrolling problem
Posted: Sep 28, 2007 2:47 PM
 
i want to scroll a large bitmap image.i have read the earlier threads.i have added a null field before bitmap field.But the large image is not scrolling ,although a down arrow is showing.
please help me out.
thanx in advance.

 


wang0043

Posts: 12
Registered: Sep, 2007

Re: large bitmap image scrolling problem
Posted: Oct 1, 2007 3:35 AM
 
I have the same problem. After try different ways using the BitmapField, I change to just paint the bitmap on the screen instead. Over write the paint method and use drawbitmap to draw the bitmap on the screen. Track the wheelball action to repaint the bitmap can achieve the scolling effect.

 

Guest
Re: large bitmap image scrolling problem
Posted: Oct 3, 2007 6:10 PM
 
Can you guys post some code on how it is done?
Thanks

 

Guest: vicky
Re: large bitmap image scrolling problem
Posted: Jul 19, 2008 2:33 AM
 
hi,

I am getting same problem in scrolling image. Can you please suggest any way

thanx

What type of manager have you added the BitmapField to?  Does the manager support have the vertical and/or horizontal scrolling style set?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: large bitmap image scrolling problem

[ Edited ]

Here's some sample code that I use to show how to scroll an image on the screen:

 

Scrolling Image Recipe

 

The "test.png" image is in the same folder as the java source if you want to download that as well.

Message Edited by richard_puckett on 07-21-2008 09:45 AM
Message Edited by richard_puckett on 07-21-2008 09:45 AM
Please use plain text.
New Developer
reyrj
Posts: 14
Registered: ‎01-07-2009
My Device: Not Specified

Re: large bitmap image scrolling problem

The above link appears to no longer be valid thus this problem is once again unsolved. Any help? Can we get this link back or write the solution on the forum here?

 

Thanks! 

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: large bitmap image scrolling problem

Here it is again:

 

import net.rim.device.api.system.Bitmap; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.Dialog; import net.rim.device.api.ui.container.MainScreen; class ScrollingImageRecipe extends UiApplication { private class ScrollingImageScreen extends MainScreen { private static final int HORZ_SCROLL_FACTOR = 10; private static final int VERT_SCROLL_FACTOR = 10; Bitmap bitmap; int left = 0; int top = 0; int maxLeft = 0; int maxTop = 0; public ScrollingImageScreen() { bitmap = Bitmap.getBitmapResource("test.png"); if (bitmap == null) { UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert("Failed to load image"); System.exit(0); } }); return; } if (bitmap.getWidth() > Graphics.getScreenWidth()) { maxLeft = bitmap.getWidth() - Graphics.getScreenWidth(); } if (bitmap.getHeight() > Graphics.getScreenHeight()) { maxTop = bitmap.getHeight() - Graphics.getScreenHeight(); } } protected void paint(Graphics graphics) { if (bitmap != null) { graphics.drawBitmap(0, 0, Graphics.getScreenWidth(), Graphics.getScreenHeight(), bitmap, left, top); } } protected boolean navigationMovement(int dx, int dy, int status, int time) { left += (dx * HORZ_SCROLL_FACTOR); top += (dy * VERT_SCROLL_FACTOR); if (left < 0) left = 0; if (top < 0) top = 0; if (left > maxLeft) left = maxLeft; if (top > maxTop) top = maxTop; invalidate(); return true; } } public static void main(String[] args){ ScrollingImageRecipe app = new ScrollingImageRecipe(); app.enterEventDispatcher(); } ScrollingImageRecipe() { pushScreen(new ScrollingImageScreen()); } }

 

Please use plain text.
New Contributor
chinmay63
Posts: 6
Registered: ‎04-28-2010
My Device: Storm 9500
My Carrier: AT&T

Re: large bitmap image scrolling problem

I dont know if your solution works or not

But check the link below, that worked great for me

http://supportforums.blackberry.com/t5/Java-Development/Create-a-scrollable-image-field/ta-p/444955

Please use plain text.
New Contributor
deepakgoel999
Posts: 2
Registered: ‎12-27-2010
My Device: 9550
My Carrier: developer

Re: large bitmap image scrolling problem

i go through your link bt it throws illegal argument exception on simulator

please help me in this regard...

 

 

thnx in advance

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: large bitmap image scrolling problem

Welcome to the forum.

 

I suggest you start a new Thread with your new problem.  But before you do that, please search the forum for similar problems.  IllegalStateException is a common problem and there are a few common things (like Field already parented, not updating on the Event Thread) that you should eliminate before asking the question again.  You will also find that the detail message (use the exception.toString() to print it) will be useful. 

Please use plain text.