/** Notifies the tool that its settings have changed. */ private void updateToolSettings() { final PaintTool activePaintTool = paintSurface.getPaintTool(); if (activePaintTool == null) return; activePaintTool.endSession(); activePaintTool.set(toolSettings); activePaintTool.beginSession(); }
/** Disposes of all resources associated with a particular instance of the PaintExample. */ public void dispose() { if (paintSurface != null) paintSurface.dispose(); if (paintColors != null) for (int i = 0; i < paintColors.length; ++i) { final Color color = paintColors[i]; if (color != null) color.dispose(); } paintDefaultFont = null; paintColors = null; paintSurface = null; freeResources(); }
/** Selects a tool given its ID. */ public void setPaintTool(int id) { PaintTool paintTool = (PaintTool) PaintExample.tools[id].data; paintSurface.setPaintSession(paintTool); updateToolSettings(); }