Re: File Explorer in Java
On 5/26/2010 5:11 PM, Chaitanya wrote:
Hi Java Gurus,
I need to implement a File Explorer that looks and works like the
native OS Explorer using Java.
I have looked at both Swing and SWT/JFace, and decided to go for Swing
as my code is going to run as an applet and I want platform
independence.
As I am looking for mimicking the default explorer look and feel, I
have to arrange icons in a grid fashion using Swing. How do I do this?
Do I get the list of files, get icons for them and then populate my
JPanel, item by item?
Is there a simpler/more direct way of doing this?
Thanks,
Chaitanya.
If what you really want is to have a file choose, check out JFileChooser.
If you truly want an "explorer" style window, then you'll have to target
several platforms. Unix/Linux have a few, just to start with. Windows
has several different kinds, depending on the version (XP is different
than NT, Vista is different still). Mac OSX also has a different style.
So, do you *really* need it to L&F like the Native OS explorer, or is
that just a "nice-to-have"?
Personally, I think it would be better to look at it from functional
requirements. What do you want the user to be able to do? Be more
specifically than "everything they can in Explorer." Once you have those
requirements nailed down, then try to decide what the best UI experience
is for the User.
*Then*, figure out how to implement it.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>