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
Developer
AsriDwitiya
Posts: 62
Registered: ‎08-08-2008
My Device: Not Specified

RolloverImage

Please help me.,i can't make rolloverimage in netrim package,,but in J2ME i can make rolloverimage,..!!!I need the sample source code...please...
Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: RolloverImage

create your own class that extends BitmapField.
Let it have two bitmaps.
Overwrite onFocus and onUnFocus to show the correct bitmap.
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
Developer
AsriDwitiya
Posts: 62
Registered: ‎08-08-2008
My Device: Not Specified

Re: RolloverImage

Can you give me the sample source code ???thanx before...
Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: RolloverImage

actually, no. i develop code for my living and read or answer the forums from work.
it should not be complicated to do it for yourself with the hints i gave you.
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
Developer
yosoh
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: RolloverImage

I think this article might help you:

 

How To - Define a rollover icon for an application

 

regards,

 

yosoh 

 

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
Please use plain text.
Developer
AsriDwitiya
Posts: 62
Registered: ‎08-08-2008
My Device: Not Specified

Re: RolloverImage

 That is a rollover icon in a home screen blackerry not rollover banner in my aplication..
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: RolloverImage

I agree with Simon's comments, especially because if you do it yourself, you will understand what is going.  Cut and Paste just leads to lots of code that you don't understand, and when it fails, you are stuck.

 

However the following code was posted by 'bsr' in the old forum.  Say thanks to Jon.  But it is not rocket science is it.....

 

this will use two images, one as a normal button image and a second for rollover when it comes into focus:

BitmapField myimageButton = new BitmapField(image, BitmapField.FOCUSABLE | BitmapField.FIELD_HCENTER){
public void onFocus(int direction){
setBitmap(imagerollover);
}
public void onUnfocus(){
setBitmap(image);
}
public boolean trackwheelClick(int status, int time){
System.out.println("myimageButton event");
return true;
}
};

Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: RolloverImage

use navigationclick instead of trackwheelclick though, the later will cause problems when building in 4.5+ enviroments (it still runs on the device afaik)
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
Developer
AsriDwitiya
Posts: 62
Registered: ‎08-08-2008
My Device: Not Specified

Re: RolloverImage

Ok..thanks for all of you...i understand now.,maybe in onfocus condition i can place "set bitmap" twice or more..maybe...that's true or not???

O

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

Re: RolloverImage

Not sure what you mean by:

"set bitmap" twice or more 

 

I would have thought in onFocus, you would put the image you wanted to appear when the button was in focus?

 

What are you trying to do?

Please use plain text.