www.ciware.org
Products | Examples |Credits | Contact | Copyright
Next
First, download iGrid libray here. iGrid-2012-0001.jar
If you are using Eclipse IDE, add the libray to eclipse Java Build Path. "Project > Properties > Java Build Path > Add External JARs..."
Now try to create your iGrid example as easy as following.
Setting values in the cells of the iGrid.


package test;

import javax.swing.JFrame;


import org.ciware.lib.UI.iGrid.IColumn;
import org.ciware.lib.UI.iGrid.IGrid;

public class GridExample01 extends JFrame {

	public static void main(String[] args) {
        try{
        	GridExample01 gridExample01 = new GridExample01();
        	gridExample01.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        	gridExample01.setVisible(true);

        	IGrid iGrid = new IGrid();
        	gridExample01.getContentPane().add(iGrid);
        	gridExample01.setSize(300, 300);   

        	iGrid.addColumn(new IColumn("ID"));
        	iGrid.addColumn(new IColumn("Name"));
        	
        	/*
        	 * cell value assignment
        	 */
        	iGrid.setCellValueAt(0, 0, "emp01");
        	iGrid.setCellValueAt(0, 1, "Mr. Young");
        	
        	iGrid.setCellValueAt(1, 0, "emp02");
        	iGrid.setCellValueAt(1, 1, "Ms. Pretty");
        	
        	/*
        	 * Setting values in loop.
        	 */
        	/*
        	for(int i=2; i<10; i++){
        		iGrid.setCellValueAt(i, 0, "emp " + (i+1));
        		iGrid.setCellValueAt(i, 1, "Mr. No.  " + (i+1));
        		
        	}
        	*/
        	
        }catch(Exception e){
        	
        }
	}
}


Copyright @ ciware.org. All rights reserved. 2012.