James Selvakumar’s Blog

December 11, 2007

Google’s excellent new service..!!!

Filed under: Uncategorized — James @ 2:41 pm

Guys who want to type in their regional fonts (for example, in an indian language) can rely upon google’s “Transliteration service”, a wonderful effort from google.

Just type in english and press “space bar” to watch the typed text getting automatically “trans scripted” to your language of choice.

Just a small example here in the indian language “tamil”.

To say “Wishes” in tamil, i just type “vaazhthukkal” and press space.
Google trans scripts it into “வாழ்த்துக்கள்” (this might not be displayed properly in firefox, view this page in IE to see it better)

Thrilled…?
Check the link below to explore further:

Google Transliteration

சும்மா அதிருத்திலே

December 10, 2007

Vote for developer.com’s Product of the Year 2008

Filed under: Uncategorized — James @ 4:16 pm

Don’t miss this great opportunity.
Cast your vote for your favorite tool/technology.

Yes, NetBeans, Eclipse, Glassfish etc.. are in the list

Click the link here to go to the poll booth.

Product of the year 2008

Hurry! The voting ends on December 21, 2007.

December 3, 2007

Implementing session timeout in swing apps

Filed under: java,swing — James @ 2:06 pm
Tags: , ,

If you are working in a web based project, the term “session” must be a frequently used one. “I want to implement a HttpSessionListener”, “How do I access http session?”, “Should i store my user state in http session or in a session bean?”.

But I just wondered, how to implement that in a swing application? (Sorry, i haven’t learn swing application framework yet)

Consider this typical scenario:
A user has logged into the swing application and has opened some 2 or three windows (JFrames). Now the user goes somewhere leaving the system idle.
How can we logout the user automatically here (for security reasons)?
How to close the opened resources?

I initially thought of writing a global event listener and implementing that in all the user interface classes. But that looked like a bad idea for me, because that would involve a lot of code changes.

So I searched through the net and found out a solution from a java forum (thanks camickr).
In contrast to my expectations, it was quite simple though. And here it is:

private void trackSystemEvents()
{
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
{
public void eventDispatched(AWTEvent event)
{
String eventText = event.toString();
if(eventText.indexOf(“PRESSED”) != -1 || eventText.indexOf(“RELEASED”) != -1)
{
SessionMonitor.getInstance().setLastActionTime(System.currentTimeMillis());
}
}
}, AWTEvent.MOUSE_EVENT_MASK + AWTEvent.KEY_EVENT_MASK);
}

Here, i want to track the user activity through a “global” listener kind of thing. And here the event listener is registered with AWTEvent.MOUSE_EVENT_MASK and AWTEvent.KEY_EVENT_MASK. That means, only mouse events and key events shall be tracked.

And i don’t want to track the mouse moved/entered events and that’s why the small “if” condition which checks only for “pressed/released” actions like key pressed, mouse released etc.

This will help you in implementing the logic to track session timeout.

And spice it up with “observer” pattern to notify your user interfaces to close the opened resources.

December 1, 2007

Third party swing components

Filed under: java — James @ 7:55 am

I’ve been blogging about Java IDEs for quite some time, and i thought of taking a different route this time and hence this topic.

I’ve been working with java swing for a long time. I remember the days, where i use to struggle a lot to design a decent swing application. Then i managed to learn some techinques to come up with some decent, if not great design. Those were the days when NetBeans GUI builder was not there.
Then NetBeans came and made swing development a breeze.

Though NetBeans made it very easy to design swing apps, the swing component suite remains the same and hasn’t evolved much. You are left with the basic components like label, textfield, scrollpane, table, tree etc. Though these components are sufficient for most of the applications and swing itself is very much extensible, creating components that meets your need is not impossible.

But who want to invest and develop things like date chooser or tree table, which is needed by even the smallest of the applications?. Thank God, there are legions of third party components available and many are open source (that’s the beauty of java). There is swingx (tons of components), l2fprod, jcalendar, jfreechart, jide etc. And if one takes “look and feel” providers as well then there is jgoodies, substance (improving day by day), liquidlnf (we use it in some of our projects), synthetica and so on…

But wait!!! which one should i choose? Which integrates better with my application, with other components? Are they consistent across different look and feels?

I’ve been using components like jcalendar, jfreechart for a while and i can say that, they have worked very well so far.
I’ve been exploring swingx for quite some time and i’m really impressed with the component suite it boasts now. (But i wonder, whether swingx has a stable release yet or not. Whenever i go to swinglabs.org/downloads, i find only milestones and weekly builds. So i’m afraid that i may end up using unstable components. But i really like their components, especially the sortable table/treetable. We spend so much of time in providing sortable functionality to our JTables ):

I’ve used look and feels provided by jgoodies, substance and liquidlnf. Among the three, i prefer jgoodies for their clean and professional look. But we are using liquidlnf in quite a number of projects. Substance is really amazing, but i couldn’t use it because our applications are mostly for business users, so we don’t want all those cool effects and themes. But i’m really looking forward to use substance in our upcoming projects because substance now provides some cool themse like “SubstanceBusinessBlueSteel” etc.

Of late, i’ve been exploring JIDE swing suite and i was amazed at their vast component suite and quality.
You can even design an application as complex as an IDE, using JIDE components. Amazing!!!
You should see their demo applications which mocks visual studio and msword. It was very realistic. Great work!!
They even have a code editor component, which looks exactly like Intellij IDEA’s code editor.
(Does IDEA use jide components?)

Even more shocking was the fact that some of the JIDE components are open sourced. I explored their open source component suite and though they are basic, they provide great functionality (like searchable table, searchable bar)
I’m really looking forward to use some of their open source components (their commericial components are bit expensive, but i think they are worth of it)

Do you use any third party swing components? If yes, can you share your experience?

Theme: Rubric. Get a free blog at WordPress.com

Follow

Get every new post delivered to your Inbox.