Capturing Screen in Java, Your Own printscreen

I happened to visit a cyber cafe for some reasons, and I had to take the screenshot of the screen and Alas, for some (security :P) reasons, print screen was not working. Grrrr..
Luckily, the guy had JDK installed on his machine and I had some good 10 – 15 minutes to pull this up. So I decided to quickly use Java to capture the screen and thought to share the Utility with you. Offcourse! I have now added Swing help everyone out here.
You can skip the entire post and can play around with the code / utility with section downloads below –
Downloads –


No I want to code!

Creating and reading Annotations & Reflection in Java

Annotations are very helpful tool while programming in Java. It is a alternative to the traditional XML based configurations. Spring has picked it up early and I must admit quite beautifully.
In case you are working on something and want to use annotations for your code, here is a small guide; it will definatly make your code look clean and also will kick off the trouble of reading XMLs.
For simplicity, lets create a mock of reading column name and its value, similar to JPA.
 Get the Code

Spring MVC 3 Tutorials [ An Introduction ]

So what is Spring MVC ?
Spring MVC is the web component of Spring’s framework apart from Spring WebFlow. Opposed to WebFlow which provides “flow” of the application MVC is more basic and robust implementation of MVC architecture. It provides a rapid development environment by easy integration with spring for enterprise applications. The flexible design of Spring enables Spring MVC to be highly configurable. Read more about Spring MVC here.
[ad#in-blog]
Lets get started with simple MVC project –
Read complete!

Understanding Blocks in Java

Java provides several ways of instantiating objects / classes. One of the most interesting features being blocks.
Java gives you an option to create two types of blocks –

  • Initializer blocks
  • Static blocks

Initializer blocks popularly known as Instance initializers are used to do something when an Object is created. Simple program below demonstrates a block :
[ad#in-blog]
Complete post!