package Current.plot.Plotters; import Current.basic.*; import Current.manage.*; import java.awt.*; import java.io.Serializable; /** An example XPlotter * * The purpose of this class is to contain the bare minimum amount of information * necessary to do a plot (of this type). * * When a tile is saved to a file, the data saved will be * 1) A word * 2) A color * 3) an XPlotter (say this XPlotter) * * From this data McBilliards can reconstruct the tile in another session * using "plotter.plot(word, color, I, M);" * * The moral is that an XPlotter should not hold unnecessary data * (e.g. a Manager) because that will make these saved files much bigger. * (Furthermore a Manager can not be recovered from a file) */ public class XNewPlotter implements XPlotter, Serializable { // This int represents some plot setting public int some_int; /** default constructor */ public XNewPlotter() { some_int=0; } /** copy constructor */ public XNewPlotter(XNewPlotter p) { some_int=p.some_int; } /** plots the tile */ public Tile plot(String word, Color C, Interrupter I, Manager M){ // here you want to actually plot the tile // for example look at XFillPlotter.plot // you would probably want to use the plot settings (e.g. some_int) here return null; } /** build a controlling canvas */ public Component getController(Manager M) { return new XNewPlotterController(M, this); } /** Return the name of the plot technique */ public String getName() { return "new"; } /** Returns true if the plot can be run. This is useful for example * if the plot relies on C code which may or may not be available */ public boolean canRun() { return true; } // /** return the documentation for this plotter */ // public HelpDocument document(){ // return null; // } /** button color */ public Color getColor() { return Color.blue; } }