Skip to content

Lessons Learnt – 30Nov2011

December 1, 2011

Recently had to develop a new utility using Swing.

Though i had opportunity of using Swing earlier in my career, i have not worked on end-to-end swing work.

I was struggling to create a layout which looks good. But NetBeans rescued me from this shabby job. Used NetBeans to create the UI component alone. It was a no brainers job. The layout was created within 5-10 minutes. Thanks Deepak for taking this route. Though i have IntelliJ and NetBeans installed on my system, lacked this particular trick.

Once this was done, i had to parse the XLS files (Both XLS and XLSX) and for the first time, using the latest apache poi dependency. Though i started using 3.5 during the earlier days, it was fragile as we adapted that one as soon as it was released. But now, it was  cake walk.

Wanted to know the type / content type of the file.

Use anyone of the following based on the requirement

new JFileChooser().getTypeDescription(File f)

URL fileURL = new URL(“file:c:\a.exe”);

URLConnection fileUC = fileURL.openConnection();


There are other ways as well, but i was able to achieve my functionality using the URL approach.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: