Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-29-2007, 09:37 AM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
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
CruxBlack
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-29-2007, 04:39 PM
Senior Member
 
Join Date: Jul 2007
Posts: 134
brianhks will become famous soon enough
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-29-2007, 05:08 PM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
So...Java is limited to its component alone?
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?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-29-2007, 06:40 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-29-2007, 08:13 PM
Senior Member
 
Join Date: Jul 2007
Posts: 134
brianhks will become famous soon enough
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-30-2007, 03:19 AM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Oh, well ill try looking for it
Thanks for the info guys
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listener for JFrame size change Thez AWT / Swing 10 02-14-2008 04:10 PM
Listener for SWT event Java Tip Java Tips 0 01-08-2008 10:04 AM
Listener collision on game cachi Java Applets 1 08-07-2007 08:48 AM
add an undo listener to a Jtable christina Advanced Java 1 08-06-2007 08:49 PM
Operator < cannot be applied to java.lang.Object, Object Albert Advanced Java 1 07-13-2007 04:19 PM


All times are GMT +3. The time now is 02:37 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org