I can't figure out, how to use getDeclaredMethods() (reflection) if the user chooses the file from GUI.
Something like this:
Class inclass= Class.forName("ClassName");
Method methods = inclass.getDeclaredMethods();
But I don't know "ClassName", I get it later.
I'd like to get the declared methods from the input file, and then list them in my GUI. The user can choose a txt or java file, when he/she did, the program will get the methods from this (if there are any) and list them on a jList.
Works if I know the Object's name, but not if it comes later.additional information copied from comment below
So my program would work like this: it starts, the user chooses a file (txt or java), when this happens the program gets the file's text into an Arraylist, and list's the file's methods and fields on a JList and displays them.
But the inputfile.getClass() won't work, since it's not an object, and I don't know how to get the input file's class, if I don't know the class name before the program starts.
Thank you for helping me.