Rating Bar Like Android In Codename One
I want to add Add Raring Bar in a Form of codename one like android.. But am afraid there is no GUI for to create in codename one.. Is there any other option for to create it..
Solution 1:
I think someone contributed a component like that on the discussion forum once, but I can't find the link.
It should be relatively simple to create using something like this (didn't test this code though):
ContainerstarSelect=newContainer(newBoxLayout(BoxLayout.X_AXIS));
for(intiter=0 ; iter < 5 ; iter++) {
createStarButton(starSelect);
}
voidcreateStarButton(final Container parent) {
finalCheckBoxcb=newCheckBox();
cb.setToggle(true);
cb.setIcon(unselectedStarIcon);
cb.setPressedIcon(selectedStarIcon);
cb.addActionListener(newActionListener() {
publicvoidactionPerformed(ActionEvent ev) {
if(cb.isSelected()) {
booleanselected=true;
for(intiter=0 ; iter < parent.getComponentCount() ; iter++) {
Componentcurrent= parent.getComponentAt(iter);
if(current == cb) {
selected = false;
continue;
}
((CheckBox)cb).setSelected(selected);
}
}
}
});
parent.addComponent(cb);
}
Post a Comment for "Rating Bar Like Android In Codename One"