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

📄 connectedtexttool.java

📁 JHotDraw学习过程中对数组的测试程序haha 学习过程中对数组的测试程序
💻 JAVA
字号:
/* * @(#)ConnectedTextTool.java 5.1 * */package CH.ifa.draw.figures;import java.awt.*;import java.awt.event.MouseEvent;import CH.ifa.draw.framework.*;import CH.ifa.draw.standard.*;/** * Tool to create new or edit existing text figures. * A new text figure is connected with the clicked figure. * * @see TextHolder */public  class ConnectedTextTool extends TextTool {    boolean     fConnected = false;    public ConnectedTextTool(DrawingView view, Figure prototype) {        super(view, prototype);    }    /**     * If the pressed figure is a TextHolder it can be edited otherwise     * a new text figure is created.     */    public void mouseDown(MouseEvent e, int x, int y) {        super.mouseDown(e, x, y);	    Figure pressedFigure =  drawing().findFigureInside(x, y);	    TextHolder textHolder = (TextHolder)createdFigure();        if (!fConnected && pressedFigure != null &&                     textHolder != null && pressedFigure != textHolder) {            textHolder.connect(pressedFigure);            fConnected = true;        }    }    /**     * If the pressed figure is a TextHolder it can be edited otherwise     * a new text figure is created.     */    public void activate() {        fConnected = false;    }}

⌨️ 快捷键说明

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