⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 movileditor.java

📁 方便大家也方便自己啊。
💻 JAVA
字号:
/** *   MovilEditor.java *   Copyright 2005 Carlos Silva A. *  *   Licensed under the Apache License, Version 2.0 (the "License"); *   you may not use this file except in compliance with the License.  *   You may obtain a copy of the License at   *  *   http://www.apache.org/licenses/LICENSE-2.0 *  *   Unless required by applicable law or agreed to in writing, software *   distributed under the License is distributed on an "AS IS" BASIS, *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *   See the License for the specific language governing permissions and *   limitations under the License. *  */package jgantt.view.tree;import java.awt.Color;import java.awt.Rectangle;import java.awt.event.ActionEvent;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import javax.swing.AbstractAction;import javax.swing.JTextField;import javax.swing.KeyStroke;/** * MovilEditor * <p> * $Date: 2005/07/14 06:16:04 $ * </p> *  * @version $Revision: 1.3 $ * @author Carlos Silva */public class MovilEditor extends JTextField {    private static final long serialVersionUID = 1L;    TaskTree taskTree;    /**     *      */    public MovilEditor(TaskTree tree) {        super();        taskTree = tree;        getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),                "acceptEdit");        getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),                "cancelEdit");        getActionMap().put("acceptEdit", new AbstractAction() {            private static final long serialVersionUID = 1L;            public void actionPerformed(ActionEvent ev) {                taskTree.acceptEdit();            }        });        getActionMap().put("cancelEdit", new AbstractAction() {            private static final long serialVersionUID = 1L;            public void actionPerformed(ActionEvent ev) {                taskTree.finishEdit();            }        });        addKeyListener(new KeyListener() {            public void keyPressed(KeyEvent ev) {                switch (ev.getKeyCode()) {                case KeyEvent.VK_UP:                case KeyEvent.VK_DOWN:                    taskTree.acceptEdit();                    // taskTree.processKeyEvent(ev);                    // TODO: Revisar                    taskTree.dispatchEvent(ev);                    break;                default:                    ;                }            }            public void keyReleased(KeyEvent e) {            }            public void keyTyped(KeyEvent e) {            }        });    }    public void start(Rectangle rect, String text, boolean select) {        taskTree.add(this);        setBackground(new Color(240, 255, 240));        setBounds(rect);        setText(text);        grabFocus();        if (select)            selectAll();        grabFocus();    }    public void stop() {        taskTree.remove(this);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -