Forums Register Login

applying dot functionality in java

+Pie Number of slices to send: Send
i have prepared a application to compile the program written in jtextarea now i want to add some more functionality such as dot,example when a user presses System. all possible classes and interfaces should popup in jtextarea please tell me how to do this in java swing
eg: when user writes
import java. ---------all possible classes must be displayed---------
label1. ---------all possible functions should be displayed-------------
System.out. ---------------alll methods should be displayed-------
+Pie Number of slices to send: Send
Welcome to the Ranch

How would you do it in a non-GUI application? If you wanted the list of classes in a package to be printed, how would you do it? If you wanted all the methods of a class printed, how would you do it?
+Pie Number of slices to send: Send
its a gui application ,that is i am making it in java swing
i have no idea how would i do it,
if there is some java lib or jar file consisting of all avaliable classes & interfaces ...is something i am thinking of but i have no clear idea how to implement it when dot operator is encountered in jtextarea
please help me out its my college project
i have attached image of my gui
check it out
buntyide.png
[Thumbnail for buntyide.png]
+Pie Number of slices to send: Send
 

vibhas bhingarde wrote: . . . i have no idea how would i do it . . .

Nor have I.

But if you could work out how to do it without the GUI, that would be a big step. If you have a class, eg Object, and write a dot, how are you going to get the list of members of that class? If you can do that, getting it onto a GUI is relatively easy. You are going to have to go back to a paper and pencil (and a large eraser) and work it out from there. Also read through the Java™ Tutorials and the standard API; I can think of something in the java.lang package which might give you a hint.

You should also consider how many marks you will get for this enhancement, and whether the work involved will be rewarded with many marks, or whether you should consider some other part of the assignment. If, for example, you have to write a description of the work, and you have nothing written yet, you might earn more marks by writing the report and omitting the dot functionality.
+Pie Number of slices to send: Send
So, you're basically going to write your own IDE. Tough project.

You'll need to have fully functioning parser. To be able to list all methods for "label1" your code needs to know what "label1" is, especially its type. Likewise for System.out. Furthermore, it needs to be able to map from "List" to the "java.util.List" class if "java.util.List" is in your imports. In other words, for all variables and classes you need a mapping from that variable to its declared class. Reflection will do the rest.

The import auto completion is going to be tricky as well. Reflection does not allow you to list a package's classes or "nested" packages. That means you'll need to go to the file system. You'll need to check the rt.jar file, all JAR and ZIP files in the JRE's lib\ext folder, and all manually added JAR files and folders in the class path.
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1029 times.
Similar Threads
MVC test case
Printing documents in a webapp without opening them
How to create Xml Dynamic Menu
unicode into char
JTextArea
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:42:46.