How to set JTable Titile with Sinhala Unicode value

This is regarding request of chathura and today i am going to add Unicode based title to JTable. First create a new project using NetBeans and add a new form to project. Then add a new table to JFrame and edit the default table headers with Unicode values.

RC on JTable -> Properties -> Go to Model -> and add your new table headers to there.

Add a new Class called MyFont and i use that class to set fonts to my application

Go to your Main method and add this code inside main method.

MyFont.setUIFont(new javax.swing.plaf.FontUIResource("Iskoola pota",Font.PLAIN,18));

Compile and Run your project and see the output.

To Download the full NetBeans Project click on the below button

Download

How to insert Unicode values to MySQL using Java-Part 3

This is the last part of our Unicode based project and in this project we will see how to retrieve our inserted values from MySQL table to our GUI.

You can see  i have a button and  one combo box retrieve data and display it.Once i click my button it will go to database and get values to array list and fill my combo box. See the below code i did that.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        ArrayList names = new ArrayList();

        try
        {
            conn=getcon.creatConnection();//getting connection

            //execute query

             ResultSet rs = conn.createStatement().executeQuery("select name from unicode");

             while (rs.next())
             {

                 String Cusname = rs.getString("name");
                 names.add(Cusname);

            }

             rs.close();
             DefaultComboBoxModel model = new DefaultComboBoxModel(names.toArray());
             cmboUnicode.setModel(model);

        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(rootPane, ex);
        }

    }

same as my previous post i have to create the object top of my class like this.

connection getcon = new connection();
Connection conn;

This method will called once i click the find button.These things normal than any other program.But you must concert clearly about my connection class. Here important things of the program are

Connection class , Use general Unicode font, Use java latest version, Handle exception while you are testing or develop it

Below you can download my complete project and if you have any problem comment on me.Thank you and best of luck

Download this video
Download Project

Simple Java application with Audit file.

Hi all, today I have come up with new simple application based on one of my blog referee’s request.

He asked me to code a simple application that will handle audit file. Normally I do not do anyone’s assignments but this done because I didn’t know how to do it in java. So finally I did it. See the code and explanation on the source code for more details.

This is very simple application that will record the every process of the application (login, button click, etc…) to .dat file. In a big project this will very helpful. I did not use any data encryption method  here.

Read More »