Posts

JAVA Chart

Image
Hi, Today I explain you how to generate graphs report in Java JFreeChart is a free 100% Java chart library created by David Gilbert. JFreeChart makes it easy for developers to display professional quality charts in their applications. To download JFreeChart please check here Add this library to your project I explain here how to generate a Pie chart in java. Create a class called it Java_Test_Graphs package java_test_graphs; /** * * @author mahesh */ public class Java_Test_Graphs { /** * @param args the command line arguments */ public static void main(String[] args) {      // TODO code application logic here      Report_graphs objReport = new Report_graphs();      objReport.setSize(500, 350);      objReport.setVisible(true);      objReport.show();    } } Here Report_graphs is an another java class which is extends by javax.swing.JFrame  see below code package java_test_graphs; import org

JAVA MD5 String Encryption

Hi, Today I explain how to generate MD5 string in Java. The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check data integrity. MD5 was designed by Ron Rivest in 1991 to replace an earlier hash function, MD4. An MD5 hash is typically expressed as a 32-digit hexadecimal number . Java security package java.security provides certain useful classes to generate Hash values. Especially the class java.security. Message-digest provides applications the functionality of a message digest algorithm, such as MD5 or SHA. This generated String can be save on database for securing the user password. Create a class as follows import java.security.*; public class Test {                                      String val_1="abc",val_2="xyz";                 public static void main(String[] args) {

PDF/Excel sheet writing through JAVA

Image
Hi, Today I am going to explain the writing of PDF and Excel sheet through java.   To write the data from java to PDF file you may require the following supporting jars, jText-2.1.5.jar gnujaxp.jar jcommon-1.0.17.jar    I use the netbean IDE for the development where I added the above jars on the project library for download above jar's click here Here I create the JFileChooser to select the destination where we want to save a file Create a function which will ask you to select the file type for saving or exporting data to pdf or excel sheet public JFileChooser file_select  public void Select_fileType()  {     try         {                     file_select  =new JFileChooser();          file_select.setFileSelectionMode(JFileChooser.FILES_ONLY);          file_select.setFileFilter(new FileTypeFilter(".pdf", "PDF Document"));          file_select.setFileFilter(new FileTypeFilter(".xls", "Excel Document"))

JTable Connection with JDBC-MYSQL and Pagination Over JTable

Image
Today I show you how to use the JTable and pagination over the JTable for the data representation on the java swing. JTable is the java swing component which show the data on tabular format on the two-dimensional tables of cells. public class Jtable extends JComponent implements TableModelListener , Scrollable , TableColumnModelListener ,    ListSelectionListener , CellEditorListener , Accessible , RowSorterListener   JTable display large data at a time but it take some time to load the data so for that I have used the pagination over the table and the records are displayed on the number of pages. I used the netbean IDE 7.0.1 for the UI development I create the Jtable , and stored the data from the mysql DB. And paging the data... DefaultTableModel Tbl_Model; DefaultListModel Tbl_List; ResultSetMetaData metaDt_first; private javax.swing.JTable tbl_result; Statement st_bookingTable; ResultSet