smithers.logicpuzzles
Interface PuzzleGraphics

All Superinterfaces:
java.util.EventListener, java.awt.event.MouseListener
All Known Implementing Classes:
HanjieGraphics, MosaicGraphics, SlitherlinkGraphics

public interface PuzzleGraphics
extends java.awt.event.MouseListener

Interface for graphical representations of logic puzzles. Classes implementing this interface can draw the clues and state of logic puzzles onto graphics objects. They can also handle mouse events, usually using mouse clicks to allow the user to solve the puzzle, or call a solver to solve it. This class may assume that it is only drawing in one place, i.e. when a mouse event is received, the coordinates are the same as in the last call to draw().


Method Summary
 java.awt.Rectangle draw(java.awt.Graphics g, java.awt.Rectangle r)
          Draws the puzzle onto a graphics object.
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 

Method Detail

draw

java.awt.Rectangle draw(java.awt.Graphics g,
                        java.awt.Rectangle r)
Draws the puzzle onto a graphics object. This method should attempt to fit the puzzle into the given rectangle. The puzzle should be drawn as large as possible and centered in the region.

Parameters:
g - the graphics object to draw onto
r - the region to fit the puzzle into
Returns:
the actual bounding rectangle for the puzzle