Results 1 to 6 of 6
- 07-29-2007, 08:37 AM #1
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
Adding listener to non-Java object?
Ellow all :)
Wanna ask, im trying to make a tracker program that collects data about how many time an icon, folder(directory) or file in my computer had been accessed today, and if it has been clicked or accessed more than n times today, the program would send a response by redirecting the folder destination to another explicit destination folder that i have provided
The only idea i get is to add listener to the file or folders, to get what actions have been done to the object, and then submit it to my program which will then give orders on what to do if a certain conditions are meet
What im not sure, whether is there any way to add listener to objects not created using Java, like folders or files or window-frames in Windows?
So far all i know is adding listener to objects created as Java Component
For file, im not familiar with the File class so i haven't tried it, but just a thought, the idea is to derived the File class and implements a listener to it's subclass so that it'll listen to the real file situation, but i just wonder, will it listen in real-time execution?
So far from my knowledge, File class are able to get File data, but mouse clicks and accessed report im not sure
Anyone can help?
Thanks :D
CruxBlack
- 07-29-2007, 03:39 PM #2
Senior Member
- Join Date
- Jul 2007
- Posts
- 135
- Rep Power
- 0
Your going to have to write a COM or .Net application to do this. This will require native hooks in Windows Explorer or the file system. I know you can create a COM object that can listen to file folder events and do things to them but, with Java this cannot be done.
- 07-29-2007, 04:08 PM #3
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
So...Java is limited to its component alone?:confused:
If so, what's the closest thing i can do to implement the problem using Java then?
How bout in Linux then, could Java do it?
- 07-29-2007, 05:40 PM #4levent Guest
I dont know availability of operating system depending functionality. But if it is available in Windows, i think it should be available in Linux too.
I don't think extending Java File class will work. You will need to write this functionality in native code (e.g. C, C++) and access to it from Java using JNI. I have done a Linux/Windows interface to a mathematics library. This is not difficult! But as always, you will need to spend time to learn JNI initially.
- 07-29-2007, 07:13 PM #5
Senior Member
- Join Date
- Jul 2007
- Posts
- 135
- Rep Power
- 0
Java just isn't suited for this kind of problem. You can, as levent suggested, use JNI but you will find that in your case 90% of the code will be native and 10% will be Java. At that point it is easier to just use 100% native code.
One option you may want to look at is to create a Windows Explorer in Java. Then you can track what is going on in Java. I'm willing to bet that there is a Java File Explorer already out there if you Google for it.
- 07-30-2007, 02:19 AM #6
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
add an undo listener to a Jtable
By christina in forum Advanced JavaReplies: 12Last Post: 01-29-2009, 07:47 AM -
Listener for JFrame size change
By Thez in forum AWT / SwingReplies: 10Last Post: 02-14-2008, 03:10 PM -
Listener for SWT event
By Java Tip in forum Java TipReplies: 0Last Post: 01-08-2008, 09:04 AM -
Listener collision on game
By cachi in forum Java AppletsReplies: 1Last Post: 08-07-2007, 07:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks