By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,853 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,853 IT Pros & Developers. It's quick & easy.

Please help I have problems regarding inputing a value into an array with gui

P: 25
i have 2 classes 1 main with methods and a gui file on the mainfile I have an aDD method.
Expand|Select|Wrap|Line Numbers
  1. public void aDD(JTextField a, String[] r)
  2.     {
  3.         int x=0;
  4.         while(x<r.length)
  5.         {
  6.             r[x]=a.getText();
  7.             x++;
  8.         }
  9.  
  10.     }
  11.  
and on my gui I have 1 that returns values to the main method
Expand|Select|Wrap|Line Numbers
  1.  if (z.getSource()== add)
  2.         {   
  3.             a3.aDD(f,x);
  4.             f.setText("");
  5.  
  6.         }
  7.  
p.s.f=text area, x is a String array;
can u help me correct my mistake
Oct 29 '08 #1
Share this Question
Share on Google+
7 Replies


myusernotyours
100+
P: 188
Hi,

Can you make your question a little bit more clear? It's difficult to tell what you are trying to do...

We are all willing to help, but only if we can understand your problem see this

Regards,
Alex.
Oct 29 '08 #2

P: 25
my question is...when I add sumthin to my array the result is null can u fix my code plsss...
Oct 30 '08 #3

Expert 10K+
P: 11,448
my question is...when I add sumthin to my array the result is null can u fix my code plsss...
If you want us to help you you have to be less vague: *what* exactly turns out
to be null? The array itself? Elements in the array? Something else? Was it
null before? Where did you notice it was null?

kind regards,

Jos
Oct 30 '08 #4

P: 25
If you want us to help you you have to be less vague: *what* exactly turns out
to be null? The array itself? Elements in the array? Something else? Was it
null before? Where did you notice it was null?

kind regards,

Jos
when a display button is clicked..the return value is null..only the first entry appears and the second remains as null
Oct 30 '08 #5

Expert 10K+
P: 11,448
when a display button is clicked..the return value is null..only the first entry appears and the second remains as null
Again: *what* return value? And ActionListener doesn't supply you with a return
value. A first and second entry of *what*? You do have to be as exact as possible.

kind regards,

Jos
Oct 30 '08 #6

P: 25
the entries ion the array made by this add button..
Oct 30 '08 #7

Expert 10K+
P: 11,448
the entries ion the array made by this add button..
According to your code you put the same value in every entry (a.getText()). They
all should be equal. The getText() method can return an empty String "" but not
null. Or is there some other code that fiddles with the array values?

kind regards,

Jos
Oct 30 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.