1 /** 2 * The chess framework library. 3 * More information is available at http://www.jinchess.com/. 4 * Copyright (C) 2002 Alexander Maryanovsky. 5 * All rights reserved. 6 * 7 * The chess framework library is free software; you can redistribute 8 * it and/or modify it under the terms of the GNU Lesser General Public License 9 * as published by the Free Software Foundation; either version 2 of the 10 * License, or (at your option) any later version. 11 * 12 * The chess framework library is distributed in the hope that it will 13 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with the chess framework library; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22 package free.chess; 23 24 import java.awt.Graphics; 25 import java.awt.Component; 26 import java.awt.Rectangle; 27 28 29 /** 30 * An interface for classes that paint the pieces (normally on a 31 * <code>JBoard</code>). 32 */ 33 34 public interface PiecePainter{ 35 36 37 38 /** 39 * Paints the given piece at the given coordinates on the given 40 * <code>Graphics</code> object scaled to the given size. The 41 * <code>component</code> argument may be null. The <code>shaded</code> 42 * argument specifies whether the piece should be drawn in a special, shaded 43 * manner. 44 */ 45 paintPiece(Piece piece, Graphics g, Component component, Rectangle rect, boolean shaded)46 void paintPiece(Piece piece, Graphics g, Component component, Rectangle rect, boolean shaded); 47 48 49 50 /** 51 * Returns a new <code>PiecePainter</code> of the same class as this one. 52 * Implementations which are immutable may return this instance itself instead 53 * of an actual copy. 54 */ 55 freshInstance()56 PiecePainter freshInstance(); 57 58 59 60 } 61