For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2004 > Re: Vector Help!!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Vector Help!!
Row

2004-04-22, 10:35 am

Maybe i should elaborate a little more

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 ");
}
}

My QUESTION:

How would i use a "Class level variable" to store an instance of the
iterator in.?? ( as steve mentioned in the quote below)
I understand this would stop me creating the ListIterator every time i
press next or previous ( thus solving my problem hopefully)???????????

Can someone help me out here???????

Rowan.

[color=darkred]
>
> "SPG" <steve.nospoo.goodsell@nopoo.blueyonder.co.uk> wrote in message news:<LFvhc.27$T87.493699@news-text.cableinet.net>...
Mark Haase

2004-04-22, 10:33 pm

In article <4d68ed39.0404220553.310f27e@posting.google.com>,
soul_fly@punkass.com (Row) wrote:

> 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.


are you trying to troll? you've already gotten your answer!

besides, in what sense does it "work" if as soon as you push a button it
freezes??

--
|\/| /| |2 |<
mehaase(at)sas(dot)upenn(dot)edu
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com