Creating

Top  Previous  Next

 

You can create your own Style by implementing the Style interface and implementing the method:

 

public void apply(java.awt.Component c, javax.swing.JTable table, int row, int column);

 

Example: Create a style that paints alternate cells with a red background color.

 

Style myStyle = new Style() {

       public void apply(java.awt.Component c, javax.swing.JTable table, int row, int column) {

               if (row % 1 == 0 && column % 1 == 0) {

                       c.setBackGround(Color.red);

               }

       }

};