亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? graphicalboard.java

?? 設計一個軟件的啟動過程界面
?? JAVA
字號:
import java.awt.*;import java.awt.event.*;/** A graphical (AWT-based) front-end for KnightBoard. Provides completely    automatic and adjusting display as well as intuitive drag functionality    for resizing the board. <P>    Dragging is implemented completely within the class. The class provides    event notification in a fashion similar to other AWT classes. To use these    events, the caller must specify an object implementing the BoardListener    interface using setBoardListener(); however, this is optional. <P>    By default, both mouse clicks on squares and resizing by dragging borders    are disabled. After specifying a listener, they may be enabled with    setClickable() and setResizable(), respectively. <P>    Note: GraphicalBoard subclasses java.awt.Canvas via KnightBoard.    @see KnightBoard    @see java.awt.Canvas    @see BoardListener*/public class GraphicalBoard extends KnightBoard implements MouseListener, MouseMotionListener {    /** Maximum width and height of the board in squares. */    public static final int MAX_DIMENSION = 10;    private static final int GAP = 5, BORDER = 12;    private static final int NO_DRAG = 0, E_DRAG = 1, S_DRAG = 2, SE_DRAG = E_DRAG+S_DRAG;    private boolean resizable = false, clickable = false;    private BoardListener listener = null;    private Image image;    private int dragging = NO_DRAG;    private boolean pressed = false;    private int squaresize, boardwidth, boardheight;    private int new_width = width, new_height = height;    private int squarex, squarey;    private int[][] oldcontent;    private boolean drawall = true;    /** Constructs a new GraphicalBoard of the specified dimensions.        The knight image is drawn on the current location of the knight,        being scaled to fit within the square.        @param width width of the board in squares.        @param height height of the board in squares.        @param knightimage image of a knight; if null, a filled red        circle is used instead.        @see #update        @see java.awt.Image    */    public GraphicalBoard(int width, int height, Image knightimage) {        super(width, height);        this.image = knightimage;        addMouseMotionListener(this);        addMouseListener(this);        setFont(new Font("SansSerif", Font.PLAIN, 12));        oldcontent = new int[width][height];    }    /** Sets the listener that will receive boardResized() and boardClicked()        events (if enabled). Only one listener can be used at a time.        @param l a class implementing the BoardListener interface.        @see #removeBoardListener        @see BoardListener    */    public void setBoardListener(BoardListener l) {        listener = l;    }    /** Removes the current listener. BoardListener events will be lost after this.        @see #setBoardListener    */    public void removeBoardListener() {        removeMouseMotionListener(this);        removeMouseListener(this);        listener = null;    }    /** Enables or disables resizing by mouse-dragging the borders.        @param b true if the board can be resized.    */    public void setResizable(boolean b) {        resizable = b;    }    /** Enables or disables choosing a square by pointing and clicking.        @param b true if a square can be selected with the mouse.    */    public void setClickable(boolean b) {        clickable = b;    }    /** Updates the board on screen. Automatically adjusts to the available        space. Only squares whose content has changed are re-drawn, unlike        in paint(). Normally, the Java AWT takes care of calling these        methods, and the programmer just uses repaint(). <P>        In unvisited squares, the value of the square is displayed.        Visited squares are marked with an orange circle and the number        of the visiting move, except for the square the knight is currently        in, in which a knight image is drawn. A filled blue circle is drawn        in the start square.        @param g the Graphics object of this canvas.        @see #paint        @see java.awt.Component#repaint    */    public void update(Graphics g) {        int nmoves = getNumMoves();        int size = (getSize().width < getSize().height) ? getSize().width : getSize().height;        // Enforce minimum size to avoid division by zero        if (size - 2 * BORDER < MAX_DIMENSION)            size = 2 * BORDER + 2 * MAX_DIMENSION;        squaresize = (size - 2 * BORDER) / MAX_DIMENSION;        for (int y = 0; y < height; y++) {            int sy = BORDER + y * squaresize;            Color bg = (y % 2 == 0) ? Color.black : Color.white;            for (int x = 0; x < width; x++) {                int sx = BORDER + x * squaresize;                int v = getValue(x, y), m = getMove(x, y);                bg = (bg == Color.white) ? Color.black : Color.white;                // Create a sum representing the content of the square.                // If it is not changed, no need to redraw.                int content = m * 4096 + v;                if (!drawall && content == oldcontent[x][y])                    continue;                oldcontent[x][y] = content;                g.setColor(bg);                g.fillRect(sx, sy, squaresize, squaresize);                if (nmoves > 0 && m == nmoves) {                    // Current position                    if (image != null)                        g.drawImage(image, sx, sy, squaresize, squaresize, this);                    else {                        g.setColor(Color.red);                        g.fillOval(sx, sy, squaresize, squaresize);                    }                } else if (v == STARTSQUARE) {                    g.setColor(Color.blue);                    g.fillOval(sx, sy, squaresize, squaresize);                } else {                    if (m > 0) {                        g.setColor(Color.orange);                        g.fillOval(sx, sy, squaresize, squaresize);                        g.setColor(Color.black);                        g.drawString(String.valueOf(m), sx + squaresize/2 - 5, sy + squaresize/2 + 5);                    } else {                        g.setColor(Color.red);                        g.drawString(String.valueOf(v), sx + squaresize/2 - 5, sy + squaresize/2 + 5);                    }                }            }        }        // Only draw borders on complete re-draw        if (drawall) {            boardwidth = width * squaresize;            boardheight = height * squaresize;            g.setColor(Color.red);            g.draw3DRect(GAP, GAP, boardwidth + 14, boardheight + 14, true);            g.draw3DRect(GAP + 2, GAP + 2, boardwidth + 10, boardheight + 10, true);            g.draw3DRect(GAP + 4, GAP + 4, boardwidth + 6, boardheight + 6, true);        }        drawall = false;    }    /** Re-draws the board completely. Normally there is no reason to call this        method directly.        @param g the Graphics object of this canvas.        @see #update        @see java.awt.Component#repaint    */    public void paint(Graphics g) {        drawall = true;        update(g);    }    /** Catches mouseMoved events and changes the mouse cursor to an appropriate        shape when moved over the right or bottom borders of the board.        Also notifies the BoardListener if a drag was ended.        @param e mouse move event received from AWT.        @see BoardListener        @see #mouseDragged    */    public void mouseMoved(MouseEvent e) {        if (!resizable || listener == null)            return;        int in = inBorder(e.getX(), e.getY());        if (in == S_DRAG)            setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));        else if (in == E_DRAG)            setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));        else if (in == SE_DRAG)            setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));        else if (in == NO_DRAG && dragging != NO_DRAG) {            // We just ended dragging            setCursor(Cursor.getDefaultCursor());            dragging = NO_DRAG;            if (new_width != width || new_height != height)                listener.boardResized(new_width, new_height);            else                repaint();        }        dragging = in;    }    /** Checks if the specified coordinates are in the borders of the board.        @param x x-coordinate.        @param y y-coordinate        @return NO_DRAG, S_DRAG, E_DRAG or SE_DRAG.    */    private int inBorder(int x, int y) {        int in = NO_DRAG;        // In bottom border?        if (x >= GAP && x <= GAP + boardwidth + 14 &&            y >= GAP + boardheight + 6 && y <= GAP + boardheight + 20)            in += S_DRAG;        // In right border?        if (y >= GAP && y <= GAP + boardheight + 14 &&            x >= GAP + boardwidth + 6 && x <= GAP + boardwidth + 20)            in += E_DRAG;        return in;    }    /** If a drag has started, draws a resizing grid as the user moves the mouse.        Ending the drag with the same board dimensions that it was started with        will cancel the drag.        @param e mouse drag event received from AWT.    */    public void mouseDragged(MouseEvent e) {        if (!resizable || listener == null)            return;                Graphics g = getGraphics();                if (dragging != NO_DRAG) {            if (dragging == E_DRAG || dragging == SE_DRAG) {                new_width = (e.getX() + squaresize/2 - BORDER) / squaresize;                if (new_width < MIN_DIMENSION)                    new_width = MIN_DIMENSION;                if (new_width > MAX_DIMENSION)                    new_width = MAX_DIMENSION;            }            if (dragging == S_DRAG || dragging == SE_DRAG) {                new_height = (e.getY() + squaresize/2 - BORDER) / squaresize;                if (new_height < MIN_DIMENSION)                    new_height = MIN_DIMENSION;                if (new_height > MAX_DIMENSION)                    new_height = MAX_DIMENSION;            }            g.setColor(getBackground());            g.fillRect(GAP, GAP, getSize().width - GAP, getSize().height - GAP);                        // Print the number of squares, in red if odd            if ((new_width*new_height) % 2 == 1)                g.setColor(Color.red);            else                g.setColor(Color.black);            g.drawString(String.valueOf(new_width * new_height), BORDER + 5, BORDER + 15);            // Draw grid            g.setColor(Color.black);            for (int y = 0; y < new_height; y++) {                for (int x = 0; x < new_width; x++) {                    g.drawRect(BORDER + x*squaresize, BORDER + y*squaresize, squaresize, squaresize);                }            }            // Draw embossed border            g.setColor(Color.red);            g.draw3DRect(GAP, GAP, new_width*squaresize + 14, new_height*squaresize + 14, false);            g.draw3DRect(GAP + 2, GAP + 2, new_width*squaresize + 10, new_height*squaresize + 10, false);            g.draw3DRect(GAP + 4, GAP + 4, new_width*squaresize + 6, new_height*squaresize + 6, false);            drawall = true;        }    }    /** Notices when a user presses the mouse button on a square inside the board,        assuming that click events are enabled. The click can be canceled by moving        the mouse out of the current square before releasing.        @param e mouse press event received from AWT.    */    public void mousePressed(MouseEvent e) {        if (!clickable || listener == null)            return;                int x = e.getX();        int y = e.getY();        Graphics g = getGraphics();                if (x > BORDER && x < BORDER + boardwidth &&            y > BORDER && y < BORDER + boardheight) {            squarex = (x - BORDER) / squaresize;            squarey = (y - BORDER) / squaresize;                        g.setXORMode(Color.red);            g.fillRect(BORDER + squarex*squaresize, BORDER + squarey*squaresize, squaresize, squaresize);            g.setPaintMode();                        pressed = true;            dragging = NO_DRAG;        }    }        /* Notifies the listener if the user clicked on a square or ended a drag.       @param e mouse button release event received from AWT.       @see BoardListener       @see #mouseDragged       @see #mousePressed    */    public void mouseReleased(MouseEvent e) {        if (listener == null)            return;                if (pressed) {            Graphics g = getGraphics();            g.setXORMode(Color.red);            g.fillRect(BORDER + squarex*squaresize, BORDER + squarey*squaresize, squaresize, squaresize);            g.setPaintMode();                        pressed = false;            if ((e.getX() - BORDER) / squaresize == squarex && (e.getY() - BORDER) / squaresize == squarey)                listener.boardClicked(squarex, squarey);                    } else if (dragging != NO_DRAG) {            // Ended dragging            setCursor(Cursor.getDefaultCursor());            dragging = NO_DRAG;            if (new_width != width || new_height != height)                listener.boardResized(new_width, new_height);            else                repaint();        }    }    public Dimension getMinimumSize() {        return new Dimension(MAX_DIMENSION*20 + 2*BORDER, MAX_DIMENSION*20 + 2*BORDER);    }        public Dimension getPreferredSize() {        return new Dimension(MAX_DIMENSION*40 + 2*BORDER, MAX_DIMENSION*40 + 2*BORDER);    }    // Dummy methods    public void mouseClicked(MouseEvent e) { }    public void mouseEntered(MouseEvent e) { }    public void mouseExited(MouseEvent e) { }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类欧美日韩国产在线| 一区二区三区四区乱视频| 欧美一区二区三区免费大片| 欧美午夜电影一区| 欧美一区日韩一区| 精品国产伦一区二区三区观看方式| 日韩美一区二区三区| 国产日本欧美一区二区| 亚洲人精品午夜| 亚洲午夜一区二区| 日产国产高清一区二区三区| 国产欧美综合在线| 1区2区3区精品视频| 亚洲精品视频在线观看免费| 性欧美疯狂xxxxbbbb| 激情偷乱视频一区二区三区| 97国产一区二区| 亚洲精品日日夜夜| 国产欧美一区二区精品久导航| 国产精品第四页| 三级欧美在线一区| 白白色 亚洲乱淫| 欧美zozozo| 亚洲一区免费观看| 成人一区二区三区中文字幕| 欧美亚洲综合在线| 最近中文字幕一区二区三区| 六月婷婷色综合| 欧美偷拍一区二区| 亚洲欧洲日韩女同| 成人中文字幕在线| 亚洲精品在线三区| 国产精品午夜久久| 国产麻豆精品视频| 欧美一区二区成人6969| 亚洲精品美国一| 91在线观看美女| 亚洲美女一区二区三区| 日韩电影一区二区三区四区| 在线国产亚洲欧美| 亚洲影院在线观看| 成人做爰69片免费看网站| 欧美日韩五月天| 亚洲成人动漫精品| 欧美一卡二卡三卡| 蜜臀99久久精品久久久久久软件| 欧美三级午夜理伦三级中视频| 亚洲柠檬福利资源导航| 在线精品视频免费观看| 亚洲一二三级电影| 欧美一区二区在线播放| 日韩不卡一区二区三区| 欧美日韩中文另类| 亚洲一区二区三区四区在线免费观看| 成人av片在线观看| 亚洲成人高清在线| 日韩亚洲欧美在线| 成人av电影观看| 日本伊人色综合网| 国产精品网曝门| 欧美老女人在线| 成人永久看片免费视频天堂| 亚洲精品视频观看| 亚洲精品一线二线三线无人区| 国产99久久久久| 日韩在线a电影| 国产欧美精品在线观看| 欧美一级片在线看| 91视视频在线直接观看在线看网页在线看 | 精品一区二区三区久久久| 最好看的中文字幕久久| 日韩一卡二卡三卡四卡| 91亚洲精品久久久蜜桃网站| 中文字幕亚洲综合久久菠萝蜜| 欧美亚洲国产一卡| 91视频国产观看| 成人h动漫精品一区二| 国产在线一区观看| 蜜臀精品久久久久久蜜臀| 一个色综合av| 亚洲人成网站色在线观看| 国产精品乱码一区二区三区软件| 6080yy午夜一二三区久久| 91在线视频播放地址| 成人影视亚洲图片在线| 国产成人av电影| eeuss鲁片一区二区三区| 成人精品免费视频| 国产成人午夜视频| 不卡电影一区二区三区| 91美女精品福利| 91丝袜国产在线播放| 欧美亚洲动漫另类| 欧美日韩激情在线| 欧美一区二区日韩| 国产网红主播福利一区二区| 制服视频三区第一页精品| 欧美日韩国产电影| 欧美精品一区二区三区高清aⅴ | 久久99热99| 成人免费看片app下载| 91麻豆国产福利在线观看| 欧美色图在线观看| 久久综合久久久久88| 综合久久给合久久狠狠狠97色| 亚洲黄色免费电影| 国产一区二区调教| 91蝌蚪porny| 久久欧美一区二区| 亚洲综合色自拍一区| 久88久久88久久久| 91亚洲精华国产精华精华液| 3751色影院一区二区三区| 欧美激情艳妇裸体舞| 日本成人在线视频网站| 99re热这里只有精品视频| 精品视频资源站| 日韩一区二区免费视频| 成人免费在线播放视频| 污片在线观看一区二区| 91啪亚洲精品| 久久久久久久综合日本| 久久精品av麻豆的观看方式| caoporen国产精品视频| 国产日产欧产精品推荐色| 日本 国产 欧美色综合| 欧美性大战久久久久久久蜜臀| 国产丝袜在线精品| 粉嫩久久99精品久久久久久夜| 欧美一区二区三区色| 午夜精品视频在线观看| 欧美在线播放高清精品| 亚洲欧美激情插| 在线观看日韩电影| 亚洲午夜日本在线观看| 欧洲在线/亚洲| 亚洲成人精品一区| 欧美一区二区日韩| 激情五月婷婷综合网| 精品国产乱码久久久久久图片 | 午夜精品久久一牛影视| 日本电影欧美片| 调教+趴+乳夹+国产+精品| 91麻豆精品国产自产在线| 奇米影视7777精品一区二区| 日韩欧美黄色影院| 本田岬高潮一区二区三区| 亚洲欧美另类综合偷拍| 欧美一二三区在线观看| 国产精品一二三| 亚洲1区2区3区4区| 国产亚洲美州欧州综合国| 91国偷自产一区二区使用方法| 有坂深雪av一区二区精品| 欧美一级片在线观看| 波波电影院一区二区三区| 午夜精品福利在线| 国产精品免费av| 欧美一级搡bbbb搡bbbb| 一本大道久久a久久精二百| 奇米888四色在线精品| 国产精品毛片无遮挡高清| 欧美色图片你懂的| 一本一道久久a久久精品| 精品中文字幕一区二区| 亚洲福利电影网| 日韩欧美一区二区免费| 欧美艳星brazzers| 色婷婷久久99综合精品jk白丝| 国产永久精品大片wwwapp| 五月婷婷久久综合| 一区二区三区成人| 亚洲男人都懂的| 中文字幕亚洲电影| 欧美国产综合一区二区| 久久综合九色欧美综合狠狠 | 亚洲成在人线在线播放| 亚洲黄色性网站| 亚洲综合一区二区三区| 亚洲婷婷国产精品电影人久久| 亚洲国产精品v| 亚洲欧美自拍偷拍| 一区二区三区美女| 男男成人高潮片免费网站| 日韩高清国产一区在线| 久久99精品国产麻豆婷婷洗澡| 极品尤物av久久免费看| 国产精品一区二区三区99| 成人a区在线观看| 在线观看国产精品网站| 欧美tickle裸体挠脚心vk| 久久精品亚洲精品国产欧美kt∨| 欧美日韩大陆一区二区| 日韩欧美色电影| 日本一区二区三区免费乱视频 | 成人免费毛片a| 欧美日韩电影一区| 国产精品久久777777| 亚洲成人免费在线观看| 国产成人av一区二区三区在线观看|