import java.awt.Graphics; import javax.swing.JPanel; /** * For drawing stuffs using an ILambda command! */ public class GraphCanvas extends JPanel { private ILambda _drawing = NoOpLambda.Singleton; // Null Object Pattern! public void setDrawable(ILambda drawing) { _drawing = drawing; } public void paintComponent (Graphics g) { super.paintComponent (g); _drawing.apply (g); } }