📄 asciifileoutframe.java
字号:
//AsciiFileOutFrame.java////hard-coded for exclusive use by AsciiDraw. Very non-oo.//I'll let you make this entire app make use of generalized library componentspackage joeh.asciidraw;import java.awt.*;public class AsciiFileOutFrame extends Frame { AsciiDrawPanel adp; String sampleName = "output.txt"; String mssgSTR = "Enter the filename:"; Label mssgLabel; TextField fileNameField; Checkbox genCode; public AsciiFileOutFrame(int xw, int yh, AsciiDrawPanel p) { super("Output file name"); this.resize(xw, yh); adp = p; this.setLayout(new BorderLayout(20,20)); mssgLabel = new Label(mssgSTR); fileNameField = new TextField(sampleName); fileNameField.setEditable(true); Panel buttonPanel = new Panel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(new Button("cancel")); buttonPanel.add(new Button("Save!")); genCode = new Checkbox("Also attach Java code for the image"); buttonPanel.add(genCode); this.add("North", mssgLabel); this.add("Center", fileNameField); this.add("South", buttonPanel); fileNameField.selectAll(); fileNameField.requestFocus(); //start being able to type into TextField }public boolean handleEvent(Event evt) { switch(evt.id) { case Event.WINDOW_DESTROY: //they close the window! { dispose(); return true; } case Event.ACTION_EVENT: { if (evt.target instanceof Button) if ("Save!".equals(evt.arg)) { adp.setDestFile(fileNameField.getText()); if (genCode.getState()) adp.doSave(true, 2); else adp.doSave(true, 1); dispose(); return true; } if ("cancel".equals(evt.arg)) { dispose(); return true; } } } return false; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -