File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Method Args Completion on Custom Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Method Args Completion on Custom Class" Watch "Method Args Completion on Custom Class" New topic

Method Args Completion on Custom Class

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

When you use an Editor with Code Completion, and you say something like:
ClassA class = new ClassA();
And when you open the first ( you get a list of Arguments the constructor or method takes.
Now, on classes that I use the list is populated and, as an example, when you instantiate a new JButton you get things like Action a, String text, Icon icon, etc.
But when I create a custom class with my own methods and then use that class somewhere else I would get, for example, Action param1, String param2, Icon param3, etc.
Can someone tell me what kind of comments I need to add to my methods to get them to display with meaningful param names instead of param1, param2, etc?
Hope that made some sense.

GenRocket - Experts at Building Test Data
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
What IDE are you using? I don't seem to have any trouble getting eclipse to recognize my own custom classes for autocompletion. If you have a problem specifically with autocompletion of recently-edited methods, you might try exiting and restarting the IDE to see if that helps it get a fresh view of your classes. And you might also try adding javadoc @param tags for each argument, to see if that helps. (But I doubt that should be necessary - autocompletion should get everything it needs from the declaration.)
Oh! If you're having a problem with classes which your system is getting from a jar file rather than source, then you may need to tell the IDE where the source is. (If you don't have the source, well, you probably can't get variable names.) In eclipse you can attach source by right-clicking on a java file, selecting Properties, and selecting Java Source Attachment.
Hope that helps...

"I'm not back." - Bill Harding, Twister
wood burning stoves
subject: Method Args Completion on Custom Class
It's not a secret anymore!