/* 3magic Coffee Table Tutorial 11 MyRank.java - Custom Drawing. © 1997-1999 3magic. All rights reserved worldwide. */ import java.awt.*; import java.lang.*; import CoffeeTable.Grid.*; /** * Here's an extension to GridPanel to draw images. */ public class MyGridPanel extends GridPanel { // Constructor public MyGridPanel() { super(); } // Constructor public MyGridPanel(int numRows, int numCols) { super(numRows, numCols); } // Override drawCell to do custom drawing. public void drawCell(Graphics g, Point cell, Rectangle aRect, boolean highlight) { if (cell.x == 2) { Image im = (Image)getCellData(cell.x, cell.y); g.drawImage(im, aRect.x, aRect.y, this); } else { super.drawCell(g, cell, aRect, highlight); } } }