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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? unlinkfishcanvas.java

?? 深入java 虛擬機中的一個Java程序
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
            }
            else {
                ObjectHandle oh = gcHeap.getObjectHandle(objectIndexOfIconThatCanBeDroppedUpon);

                // Clear the rectangle
                g.drawRect(oh.fish.getFishPosition().x, oh.fish.getFishPosition().y, oh.fish.getFishWidth(),
                    oh.fish.getFishHeight());

                // Clear the line between the nose of the from fish and the top of the tail of
                // of the to fish.
                g.drawLine(lineStart.x, lineStart.y, oh.fish.getFishPosition().x,
                    oh.fish.getFishPosition().y);

                mouseIsOverAnIconThatCanBeDroppedUpon = false;
            }
        }


        // Check to see if the line was dropped on a fish icon. If so,
        // connect the two fish by writing to the instance variable of the
        // class and repainting.
        for (int i = gcHeap.getHandlePoolSize() - 1; i >= 0; --i) {
            ObjectHandle oh = gcHeap.getObjectHandle(i + 1);
            if (!oh.free) {

                Point o = oh.fish.getFishPosition();
                if (x >= o.x && x < o.x + oh.fish.getFishWidth() && y >= o.y
                    && y < o.y + oh.fish.getFishHeight()) {

                    if (i + 1 == objectIndexOfFishIconThatWasClicked) {
                        // If they dropped on the same fish they started from, don't link.
                        break;
                    }

                    if (fishCanLink(fishIconThatWasClicked, oh.fish)) {
                        int offset = getInstanceVariableOffset(fishIconThatWasClicked, oh.fish);

                        // Set the clicked upon fish variable to equal the dropped upon
                        // fish object.
                        gcHeap.setObjectPool(fishObjectThatWasClicked.objectPos + offset, i + 1);
                        repaint();
                    }
                    break;
                }
            }
        }

        yellowLocalVarClicked = false;
        blueLocalVarClicked = false;
        redLocalVarClicked = false;
        iconClicked = false;

        return true;
    }

    public boolean mouseDrag(Event evt, int x, int y) {

        if (!iconClicked && !yellowLocalVarClicked && !blueLocalVarClicked
            && !redLocalVarClicked) {
            return true;
        }

        if (yellowLocalVarClicked || blueLocalVarClicked || redLocalVarClicked) {

            Graphics g = getGraphics();
            g.setColor(Color.blue);
            Color colorOfClickedLocalVar = Color.yellow;
            int xLineStart = xLocalVarRectStart + localVarRectWidth;
            int yLineStart = yYellowFishLocalVarStart + (localVarRectHeight / 2);
            if (blueLocalVarClicked) {
                colorOfClickedLocalVar = Color.cyan;
                yLineStart = yBlueFishLocalVarStart + (localVarRectHeight / 2);
            }
            else if (redLocalVarClicked) {
                colorOfClickedLocalVar = Color.red;
                yLineStart = yRedFishLocalVarStart + (localVarRectHeight / 2);
            }
            g.setXORMode(colorOfClickedLocalVar);

            if (!dragging) {
                dragging = true;
            }
            else {
                // Check to see if the mouse has left an icon that can be dropped upon. If
                // so, need to erase the outline rectangle and erase the line from the nose of
                // the "from" fish to top left corner of outline rectangle of "to" fish.
                if (mouseIsOverAnIconThatCanBeDroppedUpon) {
                    ObjectHandle oh = gcHeap.getObjectHandle(objectIndexOfIconThatCanBeDroppedUpon);
                    Point o = oh.fish.getFishPosition();
                    if (x < o.x || x >= o.x + oh.fish.getFishWidth() || y < o.y
                        || y >= o.y + oh.fish.getFishHeight()) {

                        g.drawRect(oh.fish.getFishPosition().x, oh.fish.getFishPosition().y, oh.fish.getFishWidth(),
                            oh.fish.getFishHeight());

                        // Draw a line between the nose of the from fish and the top of the tail of
                        // of the to fish.
                        g.drawLine(xLineStart, yLineStart, oh.fish.getFishPosition().x,
                            oh.fish.getFishPosition().y);

                        mouseIsOverAnIconThatCanBeDroppedUpon = false;
                    }
                }
                else {
                    // No drop-on-able fish is beneath the mouse, so erase the new line between
                    // the nose of the fromFish and the previous mouse position.
                    g.drawLine(xLineStart, yLineStart, currentMouseDragPosition.x, currentMouseDragPosition.y);
                }
            }

            // Check to see if a fish is beneath the mouse that can be dropped upon.
            for (int i = gcHeap.getHandlePoolSize() - 1; i >= 0; --i) {
                ObjectHandle oh = gcHeap.getObjectHandle(i + 1);
                if (!oh.free) {

                    Point o = oh.fish.getFishPosition();
                    if (x >= o.x && x < o.x + oh.fish.getFishWidth() && y >= o.y
                        && y < o.y + oh.fish.getFishHeight()) {

                        if (!mouseIsOverAnIconThatCanBeDroppedUpon) {

                            if (oh.fish.getFishColor() == colorOfClickedLocalVar) {
                                mouseIsOverAnIconThatCanBeDroppedUpon = true;
                            }

                            if (mouseIsOverAnIconThatCanBeDroppedUpon) {
                                objectIndexOfIconThatCanBeDroppedUpon = i + 1;
                                g.drawRect(oh.fish.getFishPosition().x, oh.fish.getFishPosition().y, oh.fish.getFishWidth(),
                                    oh.fish.getFishHeight());

                                // Draw a line between the nose of the from fish and the top of the tail of
                                // of the to fish.
                                g.drawLine(xLineStart, yLineStart, oh.fish.getFishPosition().x,
                                    oh.fish.getFishPosition().y);
                            }
                        }
                        break;
                    }
                }
            }

            if (!mouseIsOverAnIconThatCanBeDroppedUpon) {
                // No drop-on-able fish is beneath the mouse, so just draw the new line between
                // the nose of the fromFish and the current mouse position.
                g.drawLine(xLineStart, yLineStart, x, y);
            }
            currentMouseDragPosition.x = x;
            currentMouseDragPosition.y = y;

            g.setPaintMode();
            return true;
        }

        FishIcon fishIconThatWasClicked = gcHeap.getObjectHandle(objectIndexOfFishIconThatWasClicked).fish;
        Color colorOfClickedFish = gcHeap.getObjectHandle(objectIndexOfFishIconThatWasClicked).fish.getFishColor();

        // Don't start dragging unless the mouse has moved a threshold number of
        // pixels in x or y.
        if (!dragging) {
            int thresholdPixels = 5;
            Point iconOrigin = fishIconThatWasClicked.getFishPosition();
            int xOriginalClick = iconOrigin.x + posOfMouseInsideIconWhenFirstPressed.x;
            int yOriginalClick = iconOrigin.y + posOfMouseInsideIconWhenFirstPressed.y;
            int xDifference = x - xOriginalClick;
            if (xDifference < 0) {
                xDifference = 0 - xDifference;
            }
            int yDifference = y - yOriginalClick;
            if (yDifference < 0) {
                yDifference = 0 - yDifference;
            }
            if (xDifference < thresholdPixels && yDifference < thresholdPixels) {
                return true;
            }
        }

        Graphics g = getGraphics();
        g.setColor(Color.blue);
        g.setXORMode(colorOfClickedFish);

        Point fishNose = fishIconThatWasClicked.getFishNosePosition();

        if (!dragging) {
            dragging = true;
        }
        else {
            // Check to see if the mouse has left an icon that can be dropped upon. If
            // so, need to erase the outline rectangle and erase the line from the nose of
            // the "from" fish to top left corner of outline rectangle of "to" fish.
            if (mouseIsOverAnIconThatCanBeDroppedUpon) {
                ObjectHandle oh = gcHeap.getObjectHandle(objectIndexOfIconThatCanBeDroppedUpon);
                Point o = oh.fish.getFishPosition();
                if (x < o.x || x >= o.x + oh.fish.getFishWidth() || y < o.y
                    || y >= o.y + oh.fish.getFishHeight()) {

                    g.drawRect(oh.fish.getFishPosition().x, oh.fish.getFishPosition().y, oh.fish.getFishWidth(),
                        oh.fish.getFishHeight());

                    // Draw a line between the nose of the from fish and the top of the tail of
                    // of the to fish.
                    g.drawLine(fishNose.x, fishNose.y, oh.fish.getFishPosition().x,
                        oh.fish.getFishPosition().y);

                    mouseIsOverAnIconThatCanBeDroppedUpon = false;
                }
            }
            else {
                // No drop-on-able fish is beneath the mouse, so erase the new line between
                // the nose of the fromFish and the previous mouse position.
                g.drawLine(fishNose.x, fishNose.y, currentMouseDragPosition.x, currentMouseDragPosition.y);
            }
        }

        // Check to see if a fish is beneath the mouse that can be dropped upon.
        for (int i = gcHeap.getHandlePoolSize() - 1; i >= 0; --i) {
            ObjectHandle oh = gcHeap.getObjectHandle(i + 1);
            if (!oh.free) {

                Point o = oh.fish.getFishPosition();
                if (x >= o.x && x < o.x + oh.fish.getFishWidth() && y >= o.y
                    && y < o.y + oh.fish.getFishHeight()) {

                    if (!mouseIsOverAnIconThatCanBeDroppedUpon) {
                        if (i + 1 == objectIndexOfFishIconThatWasClicked) {
                            // If they are over the same fish they started from, don't
                            // draw a rectangle.
                            break;
                        }

                        mouseIsOverAnIconThatCanBeDroppedUpon = fishCanLink(fishIconThatWasClicked, oh.fish);
                        if (mouseIsOverAnIconThatCanBeDroppedUpon) {
                            objectIndexOfIconThatCanBeDroppedUpon = i + 1;
                            g.drawRect(oh.fish.getFishPosition().x, oh.fish.getFishPosition().y, oh.fish.getFishWidth(),
                                oh.fish.getFishHeight());

                            // Draw a line between the nose of the from fish and the top of the tail of
                            // of the to fish.
                            g.drawLine(fishNose.x, fishNose.y, oh.fish.getFishPosition().x,
                                oh.fish.getFishPosition().y);
                        }
                    }
                    break;
                }
            }
        }

        if (!mouseIsOverAnIconThatCanBeDroppedUpon) {
            // No drop-on-able fish is beneath the mouse, so just draw the new line between
            // the nose of the fromFish and the current mouse position.
            g.drawLine(fishNose.x, fishNose.y, x, y);
        }
        currentMouseDragPosition.x = x;
        currentMouseDragPosition.y = y;

        g.setPaintMode();
        return true;
    }

    private boolean fishCanLink(FishIcon fromFish, FishIcon toFish) {

        // Red fish can link with anything.
        if (fromFish.getFishColor() == Color.red) {
            return true;
        }

        // Blue fish can link with anything except red.
        if (fromFish.getFishColor() == Color.cyan) {
            if (toFish.getFishColor() != Color.red) {
                return true;
            }
            else {
                return false;
            }
        }

        // Yellow fish can only link with yellow fish.
        if (toFish.getFishColor() == Color.yellow) {
            return true;
        }

        return false;
    }

    // getInstanceVariableOffset returns the offset from the beginning of the "from" fish
    // object in the objectPool of the variable to which the "to" fish reference should
    // be assigned. The offset is in number of ints. This assumes that the toFish is
    // a valid fish color for the from fish, e.g., yellow fromFish will only have
    // yellow toFish. The fish objects are defined as:
    //
    // class RedFish {
    //      RedFish myFriend;
    //      BlueFish myLunch;
    //      YellowFish mySnack;
    // }
    //
    // class BlueFish {
    //      BlueFish myFriend;
    //      YellowFish myLunch;
    // }
    //
    // class YellowFish {
    //      YellowFish myFriend;
    // }
    //
    private int getInstanceVariableOffset(FishIcon fromFish, FishIcon toFish) {

        // Red fish can link with anything.
        if (fromFish.getFishColor() == Color.red) {
            if (toFish.getFishColor() == Color.red) {
                return 0;
            }
            else if (toFish.getFishColor() == Color.cyan) {
                return 1;
            }
            else {
                return 2; // yellow fish
            }
        }

        // Blue fish can link with anything except red.
        if (fromFish.getFishColor() == Color.cyan) {
            if (toFish.getFishColor() == Color.cyan) {
                return 0;
            }
            else {
                return 1; // yellow fish
            }
        }

        // Yellow fish can only link with yellow fish.
        return 0;
    }
    */
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜视频网站| 欧美日韩一区小说| 在线观看网站黄不卡| 亚洲精品一区二区三区福利 | 欧美一区二视频| 国产日韩欧美亚洲| 日韩制服丝袜av| 色综合天天做天天爱| 国产日韩高清在线| 美女久久久精品| 5858s免费视频成人| 伊人性伊人情综合网| 成人黄色一级视频| 久久久综合九色合综国产精品| 日韩精品成人一区二区三区| 欧美性生活久久| 亚洲欧美色综合| av亚洲精华国产精华精华| 久久久亚洲午夜电影| 精品午夜久久福利影院| 日韩手机在线导航| 日本三级韩国三级欧美三级| 欧美色综合天天久久综合精品| 国产精品福利电影一区二区三区四区| 国产在线视频一区二区三区| 日韩亚洲欧美成人一区| 午夜电影网一区| 欧美老女人在线| 午夜精品视频一区| 911精品产国品一二三产区| 亚洲午夜激情网站| 欧美日韩国产精品自在自线| 亚洲第一福利一区| 欧美日韩免费观看一区三区| 香港成人在线视频| 欧美猛男gaygay网站| 日韩综合一区二区| 欧美一级国产精品| 国产一区不卡视频| 久久综合九色综合欧美98| 国产丶欧美丶日本不卡视频| 亚洲人成精品久久久久| 92国产精品观看| 亚洲毛片av在线| 欧美日本不卡视频| 韩国v欧美v日本v亚洲v| 久久精品日韩一区二区三区| 成人app在线观看| 亚洲自拍偷拍麻豆| 精品伦理精品一区| 不卡的看片网站| 夜夜嗨av一区二区三区中文字幕 | 亚洲一区二区三区三| 欧美群妇大交群的观看方式| 日本欧美加勒比视频| 久久久久久久久伊人| 91在线国产福利| 日本va欧美va瓶| 欧美国产日韩在线观看| 欧美性感一区二区三区| 久久99精品久久只有精品| 国产精品久久午夜夜伦鲁鲁| 欧美三级韩国三级日本一级| 乱中年女人伦av一区二区| 欧美激情在线免费观看| 欧美午夜一区二区| 国产精品一区二区91| 亚洲视频小说图片| 欧美一卡二卡三卡| 不卡av电影在线播放| 丝袜美腿成人在线| 国产精品国产三级国产aⅴ入口 | 91福利精品视频| 国内精品伊人久久久久av影院| 国产精品久久久久久久久搜平片| 日本精品一级二级| 国产大陆a不卡| 日本不卡中文字幕| 亚洲色图清纯唯美| 久久久夜色精品亚洲| 欧美精品黑人性xxxx| 不卡一区二区中文字幕| 免费成人av在线| 亚洲国产人成综合网站| 中文在线资源观看网站视频免费不卡| 欧美日韩激情在线| 色综合久久久久综合99| 国产福利一区二区三区| 日本va欧美va欧美va精品| 亚洲国产中文字幕在线视频综合| 久久久激情视频| 精品三级av在线| 91精品午夜视频| 在线成人免费视频| 欧美制服丝袜第一页| 99re这里都是精品| 成人免费视频网站在线观看| 精品伊人久久久久7777人| 丝袜美腿成人在线| 婷婷夜色潮精品综合在线| 亚洲六月丁香色婷婷综合久久 | 国产精品18久久久久久久久| 日本一不卡视频| 亚洲电影在线播放| 一区二区三区四区视频精品免费| 国产精品日日摸夜夜摸av| 亚洲国产精品黑人久久久| 2024国产精品| 国产亚洲欧美在线| 久久综合色之久久综合| 欧美精品一区二区三区四区| 日韩欧美国产成人一区二区| 91精品国产品国语在线不卡| 欧美美女bb生活片| 欧美一级高清片| 日韩一区二区免费高清| 日韩久久久久久| 日韩欧美国产一区二区在线播放| 日韩视频在线观看一区二区| 日韩美女在线视频| 欧美变态口味重另类| 精品久久国产字幕高潮| 久久久不卡影院| 国产欧美综合在线观看第十页| 国产欧美视频一区二区| 国产精品久久久久久久蜜臀| 亚洲免费观看高清完整版在线观看| 成人欧美一区二区三区黑人麻豆 | 一区二区理论电影在线观看| 一区二区三区四区在线播放| 偷拍亚洲欧洲综合| 精品一区二区久久久| 丰满少妇久久久久久久| 色网综合在线观看| 欧美美女直播网站| 久久精品视频在线免费观看 | 日本一区二区三区电影| 日韩美女久久久| 图片区小说区区亚洲影院| 捆绑调教一区二区三区| 成人黄色在线网站| 欧美日韩国产首页在线观看| 欧美不卡视频一区| 最近日韩中文字幕| 日韩国产欧美在线播放| 国产精品996| 欧美日韩一区二区在线观看| 日韩精品一区二区三区中文不卡| 国产欧美精品一区| 亚洲大片精品永久免费| 国产乱妇无码大片在线观看| 色婷婷久久久久swag精品| 日韩视频国产视频| 综合久久久久综合| 久久不见久久见免费视频7| 不卡视频一二三四| 日韩免费观看高清完整版| 亚洲女同女同女同女同女同69| 日韩精品一二三| 91女神在线视频| 久久综合一区二区| 亚洲成人tv网| av电影在线观看完整版一区二区| 欧美一区在线视频| 亚洲三级视频在线观看| 狠狠网亚洲精品| 欧美二区三区的天堂| 日韩毛片一二三区| 日本久久一区二区三区| 精品国产网站在线观看| 一区二区三区.www| 成人网在线播放| 亚洲精品在线免费观看视频| 性感美女极品91精品| 色婷婷精品大在线视频| 欧美高清在线一区二区| 麻豆91免费观看| 欧美日韩国产精选| 亚洲一区国产视频| 91视频一区二区| 国产日产精品一区| 国产尤物一区二区| 日韩三级中文字幕| 日本成人超碰在线观看| 欧美日韩国产一二三| 亚洲午夜羞羞片| 欧洲人成人精品| 亚洲图片另类小说| www.av亚洲| 亚洲天堂精品在线观看| 成人av手机在线观看| 国产精品久久毛片| eeuss鲁片一区二区三区在线看| 久久综合久久综合久久综合| 精品午夜久久福利影院| 欧美大片在线观看一区| 精品一区二区日韩| 久久蜜桃av一区精品变态类天堂| 久草在线在线精品观看| 精品成人在线观看|