James Selvakumar’s Blog

September 27, 2010

NetBeans and Maven – A quick start guide

Filed under: java,netbeans — James @ 1:56 pm
Tags: , , , , ,

A few months ago, I was reading the book “Wicket in Action”. I was new to Wicket and Maven then. I followed the instructions given in the book to create a maven project. The book went one step further and explained how to create eclipse and idea projects from the pom, but nothing was mentioned about NetBeans. I felt sad that there is no maven plugin out there to create projects that NetBeans can understand.

But later when I realized that there is no such need to create Netbeans projects from Maven pom, I was thrilled. Maven, is a first class citizen in NetBeans. Any Maven project “is a” NetBeans project.

Over the months, as I continued to learn and use Maven, NetBeans made the the learning curve easy. So I thought of putting up this post to benefit new Maven users.

Read the rest of the entry

September 11, 2010

Book Review: NetBeans Platform 6.9 Developers Guide

Filed under: java,netbeans — James @ 5:19 am
Tags: , , , ,

As I started reading a couple of chapters, I got impressed with the way the content is delivered.

The book starts with the traditional “Hello World” module and takes the reader to the advanced topics in an elegant and seamless manner. The author makes good use of screenshots which will help the beginners a lot.

Read the rest of this entry

November 4, 2009

Developing A Simple Java Application With Spring

Filed under: java — James @ 1:23 pm
Tags: ,

Spring is a powerful application framework that can be used across any layer in your application. For example, you can use Spring to manage only your data access layer or you can use Spring to provide remote services for your swing client. In this article, I will explain how to get started with Spring by developing a simple java application.

Read the rest of this entry…

September 27, 2009

Developing a simple pluggable java application

Filed under: java,netbeans — James @ 1:56 pm
Tags: , ,

Most of the applications we use on daily basis are pluggable. Popular applications like Firefox, Eclipse, NetBeans, JEdit, WordPress, Hudson are all pluggable. In fact, pluggability has played a major part in the success of most of these applications. Why not make the Java applications we develop pluggable as well? Yes, we get pluggability out of the box, if our applications are based on a rich client platform like NetBeans or Eclipse. But for some reasons if you decide not to use those platforms, it doesn’t mean that they should not be pluggable. In this article, we will learn how to write a simple pluggable application that will load it’s plugins dynamically.

Read the rest of this entry

August 26, 2009

Five different uses of Java Applets

Filed under: java — James @ 3:40 pm
Tags: , , , , ,

In a world where everyone is using technologies like Flash, Silverlight etc to present rich content, are Java Applets still used? Are they still relevant? The answer is – “Yes”. Apart from being used primarily for playing online games, Java Applets are still used in many different ways. Read more from SolitaryGeek.

July 28, 2009

NetBeans 6.7 – A quick glance

Filed under: java,netbeans — James @ 4:38 pm
Tags: ,

NetBeans 6.7 has been out for quite a while. It has got some cool new features like Hudson Integration, Issue tracker integration etc. Learn more about these features from this solitarygeek.com post.

March 19, 2008

Must have tools for a Java Developer

Filed under: java — James @ 3:54 pm
Tags: ,

Apart from your favourite IDE, I feel, a Java Developer might be very productive with the following tools (in no particular order):

- Firefox (Do I need to say anything about it?)

- Apache Ant (Not needed, if you use NetBeans. NetBeans has got bundled ant)

- JEdit (Mainly for it’s wide range of plugins. I use it’s LogViewer and HexViewer plugin frequently. Also it has got excellent syntax highlighting for your properties file, java files, nsis scripts etc)

- Subversion Version Control System(Got excellent integration with NetBeans and Eclipse. You must consider it atleast for your personal development.) You can read more about installing subversion here.

(more…)

March 12, 2008

Connecting to a database from a java web application

Filed under: java,jsp/servlets — James @ 5:14 pm
Tags: , , ,

In these days of numerous java frameworks, we often forget or don’t care about some simple things. Though this post might not be very interesting to most of you, it might help some of those to whom this might be the information they are looking for. So bear with me.

Pre-requisites:

- Latest version of Tomcat (currently 6.0.16)

- A database :-) (In my case, it’s mysql 5.0)

- Appropriate jdbc “driver” jar file for your database. (In my case, it’s mysql jdbc driverr)

(more…)

Can an underdog tout world champions?

Filed under: java,netbeans — James @ 3:58 pm
Tags: ,

This post is definitely not about a football or cricket match. It’s about an IDE.
An IDE which was considered “dead” not longback, is creating lot of buzz today.(evident from the high hits for netbeans related articles in my blog :) ) It’s like a nail-biting cricket match, where a team would come from behind to win the match and eventually the series. (Like what India did to Australia in the CB series).

NetBeans too, remains the “underdog” in the much touted “IDE” war. No victory is achieved without sincere effort and NetBeans is no different. But as we have seen in many cricket, football matches, “underdogs” can be really dangerous and can tout even “world champions”.

(more…)

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.

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.