/* * TileMemorySave.java * * Created on June 8, 2006, 10:50 PM */ package Current.popups.Memory; import java.awt.*; import java.awt.event.*; import java.awt.geom.Line2D; import org.pat.graphics.boxed.ListenString; import Current.manage.*; import Current.util.TextProcess; /** * * @author pat */ public class TileMemorySaveCanvas extends Canvas implements MouseListener, FocusListener, KeyListener { public class Success extends Canvas { ListenString LS; public Success() { setFont(new Font("sanserif", Font.PLAIN, 12)); setBackground(TileMemorySaveCanvas.this.getBackground()); LS=new ListenString("Saved current tiles to file:",this); LS.setLeft(4); LS.setTop(4); LS.showBorder=false; LS.setColors(fgColor, getBackground()); filename.setTop(4+LS.getBottom()); } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); LS.render(g); filename.render(g); } } Manager M; TileMemoryContainer cont; boolean selected=false; ListenString[] comments=new ListenString[3], options=new ListenString[3]; ListenString filename,save; public static Color fgColor=Color.black, //new Color(68,77,97), buttonBg=new Color(231,206,143); public final static int padding=4; public static final String[] yesorno={"yes","no"}; /** Creates a new instance of TileMemorySave */ public TileMemorySaveCanvas(TileMemoryContainer cont) { this.M=cont.M; this.cont=cont; setFont(new Font("sanserif", Font.PLAIN, 12)); setBackground(new Color(222,144,60)); comments[0]=new ListenString("Save Tiles", this); comments[1]=new ListenString("filename:", this); options[0]=new ListenString("MMMMMMMMMMMM", this); comments[2]=new ListenString("save tile types", this); options[1]=new ListenString("yes", yesorno, this); options[2]=new ListenString("save", this); for (int i=0; i12) { temp=temp.substring(0,12); } if (! filename.str.equals(temp)) { filename.str=temp; repaint(); return; } } } public void focusGained(java.awt.event.FocusEvent focusEvent) { } public void focusLost(java.awt.event.FocusEvent focusEvent) { if (selected) { selected=false; selectColors(); repaint(); return; } } }