1 package JSci.swing; 2 3 import java.awt.*; 4 import JSci.awt.*; 5 6 12 public abstract class JCategoryGraph2D extends JDoubleBufferedComponent implements GraphDataListener { 13 16 protected CategoryGraph2DModel model; 17 20 protected Point origin=new Point(); 21 24 protected final int scalePad=5; 25 protected final int axisPad=25; 26 protected int leftAxisPad; 27 30 public JCategoryGraph2D(CategoryGraph2DModel cgm) { 31 model=cgm; 32 model.addGraphDataListener(this); 33 } 34 37 public final void setModel(CategoryGraph2DModel cgm) { 38 model.removeGraphDataListener(this); 39 model=cgm; 40 model.addGraphDataListener(this); 41 dataChanged(new GraphDataEvent(model)); 42 } 43 46 public final CategoryGraph2DModel getModel() { 47 return model; 48 } 49 public abstract void dataChanged(GraphDataEvent e); 50 53 public Dimension getPreferredSize() { 54 return getMinimumSize(); 55 } 56 59 public Dimension getMinimumSize() { 60 return new Dimension(170, 170); 61 } 62 } 63 64 | Popular Tags |