GeeCON Prague 2014*
The moose likes Sockets and Internet Protocols and the fly likes FTP files System Icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "FTP files System Icons" Watch "FTP files System Icons" New topic
Author

FTP files System Icons

Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

hi guys,

How can we get the OS specific Icon for a given file in a remote ftp server ?
i know how to do that in java for local system files (i use FileSystemView class) but can we do it for remote ftp files ?

is there any open source library for getting system Icons for ftp files? or some java workaround to implement this?

thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
I'm not quite sure what you're trying to do. You are downloading a file via ftp, and then you get the local icon for that using FileSystemView. What other icons are you trying to get? Are you (e.g.) trying to assign a Windows icon to a local file on a Linux system?


Ping & DNS - my free Android networking tools app
Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

NO,

i'm displaying the local file system in a left JTable and using a Table cell Renderer to display system windows icons for local files.
in right jtable i'm displaying ftp remote files in a similar jtable.i want to write a ftp table cell renderer to affet icons to remote ftp files ;like i did for local files.

how can i do that ?

i hope this makes sense now.thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
Could you create a zero-sized file on the local disk that has the same file extension as the remote file? Then you might be able to use the exact same FileSystemView call.
Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

Originally posted by Ulf Dittmer:
Could you create a zero-sized file on the local disk that has the same file extension as the remote file? Then you might be able to use the exact same FileSystemView call.


thank you

yes i tried this solution but didn't worked for me perfectly:
1) first problem : i will have to create hundreds of theses temporary empty files on user machine ;and need to delete them when my applet is destroyed ;but sometimes the temp files are not deleted when i exit applet (don't know why).
2) it seems i'm not yet implementing the table cell renderer correctly : all ftp remote files and folders have an icon of 'folder' ; so I'm still not doing it right.
sorry i deleted the code i was using . i switch to only using 2icons (folder and file for ftp files) when i failed implementing this workaround correctly.i could have posted my old code here if i still have it.

can you please show me some sample code for a table cell renderer ,in which i take the extension of ftp file ,create temp File object on local computer ,then render the jtable using icon of temp file ?
also i need to delete theses temp files when i no longer need them.

i will appreciate your help

thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42046
    
  64
can you please show me some sample code for a table cell renderer ,in which i take the extension of ftp file ,create temp File object on local computer ,then render the jtable using icon of temp file ?
also i need to delete theses temp files when i no longer need them.


That would be a lot of code for someone else to write to solve your problem. Why don't you post what you have, and we'll try to figure what the problem is? (Yes, I realize you said that you inadvertently deleted it. But nobody else is going to write it for you, so you might as well start to recreate it.)
 
GeeCON Prague 2014
 
subject: FTP files System Icons