1 package JSci.awt; 2 3 import java.awt.*; 4 5 11 public abstract class CategoryGraph2D extends DoubleBufferedCanvas implements GraphDataListener { 12 15 protected CategoryGraph2DModel model; 16 19 protected Point origin=new Point(); 20 23 protected final int scalePad=5; 24 protected final int axisPad=25; 25 protected int leftAxisPad; 26 29 public CategoryGraph2D(CategoryGraph2DModel cgm) { 30 model=cgm; 31 model.addGraphDataListener(this); 32 } 33 36 public final void setModel(CategoryGraph2DModel cgm) { 37 model.removeGraphDataListener(this); 38 model=cgm; 39 model.addGraphDataListener(this); 40 dataChanged(new GraphDataEvent(model)); 41 } 42 45 public final CategoryGraph2DModel getModel() { 46 return model; 47 } 48 public abstract void dataChanged(GraphDataEvent e); 49 52 public Dimension getPreferredSize() { 53 return getMinimumSize(); 54 } 55 58 public Dimension getMinimumSize() { 59 return new Dimension(170, 170); 60 } 61 } 62 63 | Popular Tags |