I'm using Jena. I created an interface that allows to add, modify and remove instances in rdf file. I have a problem with Button Next. It works but not perfectly. I would like that it returns to the first instance when it reaches the last instance. But it does not do this, when it reaches the last instances, it repeats this last instance every time button Next is pressed. How can I solve this?
Here is my fragment code for button next:
//Button Next
class ActionSuivant implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
++indice;
ExtendedIterator instances=onto.personne.listInstances();
Individual instance = null;
for(p = 0; p < indice && instances.hasNext(); p++)
{
instance = (Individual) instances.next();
}
tabTF[0].setText(instance.getPropertyValue(onto.aPourPrenom).toString());
tabTF[1].setText(instance.getPropertyValue(onto.aPourNom).toString());
tabTF[2].setText(instance.getPropertyValue(onto.aDateNaiss).toString());
tabTF[3].setText(instance.getPropertyValue(onto.aGenre).toString());
}
}