Monthly Archives: June 2007

This is the second part of a series of articles to get people started with JasperReports. In the second part I’ll explain how to access your database to run simple queries and show them in a very simple report created with iReport. The first thing we need to do to get moving is to have iReport ready. So if you haven’t got it installed do so. Next step is to have the database driver in your iReport library folder. This means that you will need a jdbc jar packaged driver copied to the ./lib/ directory of iReport’s base folder. This […]

Getting started with JasperReports // JDBC connections (Part II)

IReport 1
This is the first of a series of articles to get you started with JasperReports. In first place, JasperReports is one of Java’s reporting engines. It’s very powerful and has lots of features that makes it comparable to commercial reporting solutions such as Crystal Reports. The first thing you need to do to start using this great peace of software is go to the project page and download it (wait). In the project page there is some documentation that will help you getting started. You must know that JasperReports is a reporting engine that integrates many capabilities. Reports are developed […]

Getting started with JasperReports // Reporting in Java (Part I)

IMPORTANT NOTICE This post was published in 2007 and some code was used to interact with databases which had no JDBC connector. It is a very bad practice and unrecommended to send SQL statements directly to a database Such a simple thing as replacing an apostrophe with an escape character from a string sometimes can become a very tedious process, more if you’re using String’s replaceAll(…) function. Replacing apostrophes from Strings may be very useful when creating Statements to pass to an SQL database, preventing SQL injection. Many may say that using PreparedStatements is easier and safer, but in many […]

Replacing Apostrophes from Strings // Cleaning String to pass them ...

Adding a KeyListener to a JTextField to detect KeyPressed events is pretty straightforward. Buy maybe you have encountered some problems when trying to detect special key such as TAB’s. This issue is due to LowLevel keyEvents captured by Swing’s default FocusTraversalKeys. What we need to do to capture the VK_TAB KeyEvent is to remove the default FocusTraversalKeys from the component. [crayon-59ebb6bfbe02f236547101/] Once we’ve done this with the component, the tab KeyEvent will not be captured by swing’s default focus traversal keys and we will be able to add events normally. [crayon-59ebb6bfbe03d549244270/]

Detecting Tab Key Pressed Event in JTextField ‘s // Event.VK_TAB ...