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

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

?? selectiondemo.java

?? Java樣例程序集合:2D
?? JAVA
字號:
/*  * SelectionDemo.java is a 1.4 application that requires one other file: *   images/starfield.gif */import javax.swing.BoxLayout;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.event.MouseInputAdapter;import java.awt.*;import java.awt.event.MouseEvent;/*  * This displays an image.  When the user drags within * the image, this program displays a rectangle and a string * indicating the bounds of the rectangle. */public class SelectionDemo {    JLabel label;    static String starFile = "images/starfield.gif";        private void buildUI(Container container, ImageIcon image) {        container.setLayout(new BoxLayout(container,                                          BoxLayout.PAGE_AXIS));                                                  SelectionArea area = new SelectionArea(image, this);        container.add(area);        label = new JLabel("Drag within the image.");        label.setLabelFor(area);        container.add(label);        //Align the left edges of the components.        area.setAlignmentX(Component.LEFT_ALIGNMENT);        label.setAlignmentX(Component.LEFT_ALIGNMENT); //redundant    }    public void updateLabel(Rectangle rect) {        int width = rect.width;        int height = rect.height;        //Make the coordinates look OK if a dimension is 0.        if (width == 0) {            width = 1;        }        if (height == 0) {            height = 1;        }        label.setText("Rectangle goes from ("                      + rect.x + ", " + rect.y + ") to ("                      + (rect.x + width - 1) + ", "                      + (rect.y + height - 1) + ").");    }    /** Returns an ImageIcon, or null if the path was invalid. */    protected static ImageIcon createImageIcon(String path) {        java.net.URL imgURL = SelectionDemo.class.getResource(path);        if (imgURL != null) {            return new ImageIcon(imgURL);        } else {            System.err.println("Couldn't find file: " + path);            return null;        }    }    /**     * Create the GUI and show it.  For thread safety,      * this method should be invoked from the      * event-dispatching thread.     */    private static void createAndShowGUI() {        //Make sure we have nice window decorations.        JFrame.setDefaultLookAndFeelDecorated(true);        //Create and set up the window.        JFrame frame = new JFrame("SelectionDemo");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        //Set up the content pane.        SelectionDemo controller = new SelectionDemo();        controller.buildUI(frame.getContentPane(),                           createImageIcon(starFile));        //Display the window.        frame.pack();        frame.setVisible(true);    }    public static void main(String[] args) {        //Schedule a job for the event-dispatching thread:        //creating and showing this application's GUI.        javax.swing.SwingUtilities.invokeLater(new Runnable() {            public void run() {                createAndShowGUI();             }        });    }        private class SelectionArea extends JLabel {        Rectangle currentRect = null;        Rectangle rectToDraw = null;        Rectangle previousRectDrawn = new Rectangle();        SelectionDemo controller;            public SelectionArea(ImageIcon image, SelectionDemo controller) {            super(image); //This component displays an image.            this.controller = controller;            setOpaque(true);            setMinimumSize(new Dimension(10,10)); //don't hog space                MyListener myListener = new MyListener();            addMouseListener(myListener);            addMouseMotionListener(myListener);        }            private class MyListener extends MouseInputAdapter {            public void mousePressed(MouseEvent e) {                int x = e.getX();                int y = e.getY();                currentRect = new Rectangle(x, y, 0, 0);                updateDrawableRect(getWidth(), getHeight());                repaint();            }                public void mouseDragged(MouseEvent e) {                updateSize(e);            }                public void mouseReleased(MouseEvent e) {                updateSize(e);            }                /*              * Update the size of the current rectangle             * and call repaint.  Because currentRect             * always has the same origin, translate it             * if the width or height is negative.             *              * For efficiency (though             * that isn't an issue for this program),             * specify the painting region using arguments             * to the repaint() call.             *              */            void updateSize(MouseEvent e) {                int x = e.getX();                int y = e.getY();                currentRect.setSize(x - currentRect.x,                                    y - currentRect.y);                updateDrawableRect(getWidth(), getHeight());                Rectangle totalRepaint = rectToDraw.union(previousRectDrawn);                repaint(totalRepaint.x, totalRepaint.y,                        totalRepaint.width, totalRepaint.height);            }        }            protected void paintComponent(Graphics g) {            super.paintComponent(g); //paints the background and image                //If currentRect exists, paint a box on top.            if (currentRect != null) {                //Draw a rectangle on top of the image.                g.setXORMode(Color.white); //Color of line varies                                           //depending on image colors                g.drawRect(rectToDraw.x, rectToDraw.y,                            rectToDraw.width - 1, rectToDraw.height - 1);                    controller.updateLabel(rectToDraw);            }        }            private void updateDrawableRect(int compWidth, int compHeight) {            int x = currentRect.x;            int y = currentRect.y;            int width = currentRect.width;            int height = currentRect.height;                //Make the width and height positive, if necessary.            if (width < 0) {                width = 0 - width;                x = x - width + 1;                 if (x < 0) {                    width += x;                     x = 0;                }            }            if (height < 0) {                height = 0 - height;                y = y - height + 1;                 if (y < 0) {                    height += y;                     y = 0;                }            }                //The rectangle shouldn't extend past the drawing area.            if ((x + width) > compWidth) {                width = compWidth - x;            }            if ((y + height) > compHeight) {                height = compHeight - y;            }                      //Update rectToDraw after saving old value.            if (rectToDraw != null) {                previousRectDrawn.setBounds(                            rectToDraw.x, rectToDraw.y,                             rectToDraw.width, rectToDraw.height);                rectToDraw.setBounds(x, y, width, height);            } else {                rectToDraw = new Rectangle(x, y, width, height);            }        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品18久久久久久久久久久久| 91久久免费观看| 91福利精品第一导航| 欧美久久久久久蜜桃| 欧美激情在线一区二区三区| 亚洲狼人国产精品| 黑人巨大精品欧美黑白配亚洲| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 国产成人精品三级麻豆| 色狠狠一区二区三区香蕉| 精品国产精品一区二区夜夜嗨| 亚洲欧美日韩国产另类专区| 激情欧美一区二区| 欧美日韩成人一区二区| 亚洲视频精选在线| 国产又黄又大久久| 欧美一卡2卡3卡4卡| 在线免费精品视频| 福利电影一区二区三区| 亚洲精品在线网站| 三级影片在线观看欧美日韩一区二区 | 日本欧美在线看| 日本韩国欧美一区| 亚洲欧洲一区二区三区| 国产毛片一区二区| 欧美mv日韩mv国产网站| 亚洲mv在线观看| 91麻豆国产福利精品| 国产精品美日韩| 国产一区二区三区久久久| 91精品国产综合久久小美女| 夜夜爽夜夜爽精品视频| 色乱码一区二区三区88| 亚洲色图视频网| av在线不卡观看免费观看| 国产日韩欧美在线一区| 国产激情91久久精品导航| 久久久久久电影| 韩国女主播一区二区三区| 欧美电影免费观看高清完整版在线观看| 亚洲影院久久精品| 欧美日韩在线免费视频| 亚洲午夜激情网页| 777奇米四色成人影色区| 日韩av中文在线观看| 欧美一区二区三区在线观看 | 亚洲少妇30p| 91伊人久久大香线蕉| 亚洲色图都市小说| 欧美色偷偷大香| 日本不卡一区二区三区| 日韩一区二区视频| 精品一区二区三区在线视频| 久久久一区二区三区捆绑**| 国产盗摄女厕一区二区三区| 国产精品久久久久久久午夜片| www..com久久爱| 一区二区三区欧美在线观看| 9191久久久久久久久久久| 美脚の诱脚舐め脚责91 | 欧美精品精品一区| 全国精品久久少妇| 久久久电影一区二区三区| 成人少妇影院yyyy| 亚洲欧洲国产日本综合| 色网站国产精品| 日韩成人一级大片| 久久久99精品免费观看不卡| 97国产精品videossex| 亚洲二区在线观看| 久久亚洲一区二区三区明星换脸| 成人美女视频在线看| 亚洲高清中文字幕| 欧美精品一区二| 91丝袜美女网| 蜜臀国产一区二区三区在线播放| 国产蜜臀av在线一区二区三区| 91麻豆精品秘密| 美女视频黄 久久| 亚洲婷婷综合色高清在线| 91精品免费观看| 成人在线一区二区三区| 无码av免费一区二区三区试看 | 处破女av一区二区| 午夜影院在线观看欧美| 中文字幕欧美日韩一区| 51午夜精品国产| 成人av在线观| 久久国产成人午夜av影院| 亚洲婷婷综合久久一本伊一区 | 免费欧美日韩国产三级电影| 中文字幕一区二区三区精华液| 欧美一区二区三区思思人| 99re这里只有精品6| 久久国产欧美日韩精品| 一区二区三区四区不卡在线| 久久精品在线免费观看| 欧美日韩一卡二卡| 91尤物视频在线观看| 国产激情精品久久久第一区二区| 五月婷婷综合网| 亚洲美女偷拍久久| 久久精品视频一区二区| 日韩欧美中文字幕制服| 欧美性猛交xxxx乱大交退制版 | 中文字幕免费不卡在线| 日韩欧美色电影| 欧美伦理影视网| 在线日韩国产精品| a4yy欧美一区二区三区| 国产成人免费9x9x人网站视频| 日韩高清不卡一区| 亚洲国产中文字幕| 亚洲综合一二三区| 亚洲最大成人综合| 一区二区三区日韩欧美| 亚洲精选一二三| 亚洲免费观看在线观看| 国产精品成人网| 成人免费一区二区三区视频| 国产精品网曝门| 国产精品欧美一级免费| 国产精品理伦片| 国产精品理论在线观看| 专区另类欧美日韩| 亚洲女厕所小便bbb| 亚洲激情图片小说视频| 亚洲综合丝袜美腿| 一区二区三区在线视频免费| 亚洲综合另类小说| 五月天激情综合| 久久99久久99| 国产麻豆精品视频| 成人免费不卡视频| 91九色最新地址| 欧美日韩一区二区三区免费看| 欧美日本不卡视频| 日韩美女主播在线视频一区二区三区| 日韩精品专区在线影院观看| 精品88久久久久88久久久| 中文字幕国产一区| 亚洲男人都懂的| 成人精品视频网站| 色婷婷精品大在线视频| 欧美三级在线视频| 精品久久久久久久久久久院品网| 精品国一区二区三区| 国产精品三级av| 亚洲福利视频一区| 精品一区二区免费| www.亚洲人| 欧美一区二区三区四区在线观看| 欧美精品一区二区三区久久久| 国产精品色哟哟| 亚洲亚洲人成综合网络| 国内精品国产三级国产a久久| 成人自拍视频在线| 欧美丰满少妇xxxbbb| wwwwww.欧美系列| 一区二区三区在线免费观看 | 秋霞av亚洲一区二区三| 国产一区二区三区在线观看免费 | 极品少妇xxxx精品少妇| 99视频热这里只有精品免费| 欧美喷潮久久久xxxxx| 国产日韩精品一区二区三区| 亚洲综合免费观看高清完整版在线| 九色porny丨国产精品| 91丨九色porny丨蝌蚪| 日韩欧美国产麻豆| 亚洲精品免费在线播放| 国内精品久久久久影院色| 91在线观看视频| 精品国产1区二区| 亚洲综合免费观看高清完整版在线| 国产麻豆视频精品| 5858s免费视频成人| 亚洲日本乱码在线观看| 国产在线精品一区二区夜色 | 日韩不卡手机在线v区| 不卡的av电影| 精品少妇一区二区三区日产乱码 | 亚洲婷婷综合久久一本伊一区| 精品一区二区三区日韩| 欧美日韩综合在线| 亚洲天堂2016| 7777精品伊人久久久大香线蕉超级流畅 | 91精品午夜视频| 一区二区三区精品视频在线| 国产成人福利片| 精品国产免费久久| 五月婷婷欧美视频| 欧美在线观看视频一区二区三区| 亚洲国产高清aⅴ视频| 激情综合五月婷婷| 日韩限制级电影在线观看| 日韩精品免费视频人成| 欧美三级日韩在线| 亚洲老司机在线| 91在线视频播放|