/* 3magic Coffee Table Tutorial 1 Tutorial1.java - Creating a simple grid. © 1997-1999 3magic. All rights reserved worldwide. */ import java.awt.*; import java.applet.*; import CoffeeTable.Grid.*; public class Tutorial1 extends Applet { public void init() { // Instantiate a new Grid Panel with 10 rows and 5 columns and other defaults like cell // selection, row and column headers, row and column lines enabled and with scrollbars. int numRows = 10; int numCols = 5; GridPanel grid = new GridPanel(numRows, numCols); // Be sure to set the preferred size if you are using it in a // layout that resizes based on preferred size. grid.setSize(300, 200); // Add it into the applet panel add(grid); // Add some data for display. for (int col=1; col<=numCols; col++) { grid.setColHeaderText(col, "Column " + col, true); for (int row=1; row<=numRows; row++) { grid.setCellText(col, row, col + ", " + row, true); } } } }