diagrameditorcontrols.java
来自「一个图形编辑器」· Java 代码 · 共 62 行
JAVA
62 行
/* * Diagram Editor Application * -------------------------- * * *** Java version *** * * FILE: Diaged.java * * JDK: Compatible with JDK 1.5 * * CONTENTS: Definition of class "DiagramEditorControls" * * AUTHOR: Zhangyi * * HISTORY: Written October 2004 */ import java.awt.* ;import java.applet.* ; class DiagramEditorControls extends Panel{ DiagramEditor diagramEditor ; Button deleteButton = new Button("Delete elements") ; Button nextDiagramButton = new Button("Next diagram") ; Button newDiagramButton = new Button("New diagram") ; Choice toolChoice = new Choice() ; public DiagramEditorControls( DiagramEditor e ) { diagramEditor = e ; diagramEditor.setControls(this) ; for (int i = 0; i < diagramEditor.toolNames.length; i++) { toolChoice.addItem(diagramEditor.toolNames[i]) ; } add(newDiagramButton) ; add(nextDiagramButton) ; add(new Label("Tool:" )) ; add(toolChoice) ; add(deleteButton) ; } public boolean action( Event e, Object arg ) { if (e.target == deleteButton) { diagramEditor.deleteElements() ; } else if (e.target == nextDiagramButton) { diagramEditor.nextDiagram() ; } else if (e.target == newDiagramButton) { diagramEditor.newDiagram() ; } else if ( e.target == toolChoice ) { int toolIndex = ((Choice) e.target).getSelectedIndex() ; diagramEditor.setTool(toolIndex) ; } return true ; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?