Hi,
Im relitivly new to java. I guess you could say im a newbie (even
though i studied it 3 years ago)
I have 2 simple questions. relating to java vectors
Question 1:
My application uses an Vector called stringArray. I am using a GUI to
access this Vector. I have 2 buttons. ("NEXT" and "PREVIOUS").
I would like to use these buttons to forwards or backwards through the
Vector Elements.
Now what i have below works. But once i push "Next" or "Previous" once
the applet just freezes and the record shown in the text area remains
the same. My code for this is below.
public void moveNext() {
try {
statLbl.setText("done");
ListIterator Lists = stringArray.listIterator();
//while (Lists.hasNext()) {
String nextElement = (String)Lists.next();
singleTextArea.setText(nextElement);
}
catch (ArrayIndexOutOfBoundsException f) {
System.out.println("No value at element");
statLbl.setText(" error ");
}
}
Question 2:
is there a way to see which element the array pointer is at?
For instance.
I need to show information on [Record No / Total Records]
I know to get the Total Records i could use:
vector.size();
But i how would i determine where i am in the array(pointer)?
I really need to finish this by friday but i have had trouble finding
what i need on the internet.
Thanks for your help in advance........i hope you can help another
newbie out!