001package horstmann.ch06_scene3; 002import java.awt.Graphics2D; 003 004/** 005 A shape that manages its selection state. 006 */ 007public abstract class SelectableShape implements SceneShape 008{ 009 public void setSelected(boolean b) 010 { 011 selected = b; 012 } 013 014 public boolean isSelected() 015 { 016 return selected; 017 } 018 019 public void drawSelection(Graphics2D g2) 020 { 021 translate(1, 1); 022 draw(g2); 023 translate(1, 1); 024 draw(g2); 025 translate(-2, -2); 026 } 027 028 private boolean selected; 029}