ishape.java

来自「windows画图板.类似于windows自带的画图程序!」· Java 代码 · 共 48 行

JAVA
48
字号

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;

/**
 * All drawing shapes should implement this interface.
 *
 * @author hysun
 */
public interface IShape {
    
    /** Corresponding to mouse pressed event type */
    public static final int RIGHT_PRESSED = 0;
    
    /** Corresponding to mouse released event type */
    public static final int LEFT_RELEASED = 1;
    
    /** Corresponding to mouse dragged event type */
    public static final int CURSOR_DRAGGED = 2;
    
    /** 
     * Code for processing draw cursor events in the drawing process.
     *
     * @param evt the MouseEvent being detected.
     * @param type the event type. can take values PRESSED, RELEASED, and 
     * DRAGGED.
     */
    public void processCursorEvent(MouseEvent evt, int type);
        
    /** 
     * To be called by the UI to draw out the shape. 
     *
     * @param g the Graphics2D context being passed for drawing.
     */
    public void draw(Graphics2D g);
    
    /**
     * Called when loading model from file.
     */
    public void setShapeData(String data) throws Exception;
    
    /**
     * Called when saving model to file.
     */
    public String getShapeData();
    
}

⌨️ 快捷键说明

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