Article View: aus.computers.java
Article #605How to return an array of strings to an applet?
From: PrEdAt0r
Date: Sat, 08 Jul 2000 00:00
Date: Sat, 08 Jul 2000 00:00
29 lines
1339 bytes
1339 bytes
Hi i have an array of strings that that has to be returned to an
appletclass.
unfortunately i m getting a nullpointerexception.
i dont know why
here is the code of the method that returns the array and the calling code
of the applet
public String[] getOutOfStockItems(){
int itemsOOS = 0;
for(int i = 0; i < it.length;i++)
if(it[i].getQuantity() < 1)
itemsOOS += 1;
osi = new String[itemsOOS];
for(int i = 0; i < it.length; i++)
if(it[i].getQuantity() < 1)
osi[i] = it[i].getName();
return osi;
}
Calling code
if (e.getSource()==bt_reorder){
String[] array = Stock.getOutOfStockItems();
for(int i = 0; i<array.length; i++){
tf_reorder.setText(tf_reorder.getText()+" "+array[i]);
}
}
Help given will be appreciated.
Technical Details
Message-ID:
<8k6eef$uln$1@bugstomper.ihug.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,2413761ff66947de,start X-Google-Attributes: gid10d6db,public From: "PrEdAt0r" <navneet@lisp.com.au> Subject: How to return an array of strings to an applet? Date: 2000/07/08 Message-ID: <8k6eef$uln$1@bugstomper.ihug.com.au> X-Deja-AN: 643843336 X-Priority: 3 X-Server-Date: 8 Jul 2000 05:33:03 GMT X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: The Internet Group (Sydney) X-MSMail-Priority: Normal Newsgroups: aus.computers.java