예제 #1
0
  /** 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();
  }
예제 #2
0
 /** 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();
 }
예제 #3
0
 /** Selects a tool given its ID. */
 public void setPaintTool(int id) {
   PaintTool paintTool = (PaintTool) PaintExample.tools[id].data;
   paintSurface.setPaintSession(paintTool);
   updateToolSettings();
 }