File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Array mistaken for a function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array mistaken for a function" Watch "Array mistaken for a function" New topic
Author

Array mistaken for a function

Bill Raterink
Greenhorn

Joined: Sep 03, 2003
Posts: 29
Hi, I'm posting this here because I'm obviously a beginner. If it belongs elsewhere, please let me know. TIA Now, I have a program that is comming along nicely, kudos to you folks here... but the following code causes me some problems. Com1 is a text field, & I want to set it to th i-th element of an array (Comment1), but I get a compiler error that Comment1(int) is not found in my class. Of course it's not, but what am I doing wrong. The second line works flawlessly.
Com1.setText(Comment1(Idx));
Com1.setText("Anything");
I've been thru several books & tutorials & I just don't seem to see HOW to set/get data into/out of a textField.

Thanks again, -Bill.
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
It should be
Com1.setText(Comment1[Idx]);
Use [] and not ()


Mani
Quaerendo Invenietis
Bill Raterink
Greenhorn

Joined: Sep 03, 2003
Posts: 29
Thank you so much for the help. I only regret not asking 6 hrs ago.
Thanks, -Bill.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array mistaken for a function