I’m planning to create my first custom component and that would be carousel component to achieve a functionality of this:
http://sorgalla.com/projects/jcarousel/examples/static_simple.html
Some pointers would be helpful regarding the existing components which could be used and tweaked etc.
thanks.
hi ,
A sample algorithm may help u.
-
Create image objects and add to an arraylist
-
draw a hlayout
2.1. add prev button
2.2. hlayout where the images to be placed ,set the hlayout setanimate members() - for animation
2.3. add next button
2.4 set curved border for this layout
2.5 set background image for this
-
set the no:of images to be shown in each page..(in the example its 3)=pagecount
then you find out the no:of pages by arraylist.size()/no:of images per page=noofPages
-
make the activeLinkIdvariable to 1 --its a pointer variable
-
in prevbutton click,
if(activeLinkId>1){
clearImageLayout(pageCount * (activeLinkId-1),pageCount * (activeLinkId));
activeLinkId --;
setImageLayout(pageCount * (activeLinkId-1), pageCount * activeLinkId);
}
- on next button click
if(activeLinkId<nofPages){
clearImageLayout(pageCount * (activeLinkId-1),pageCount * (activeLinkId));
activeLinkId ++;
setImageLayout(pageCount * (activeLinkId-1), pageCount * (activeLinkId));
}
the functions
clearImageLayout(int start,int end){
//iterate the arraylist of images ,clear the existing images,
//i mean remove the images from the imagelayout
}
setImageLayout(int start,int end){
//iterate the arraylist of images ,add images to the imagelayout in this range
}
I have implemented this well…
u also try it..