Package net.cakenet.jsaton.ui.tools

Examples of net.cakenet.jsaton.ui.tools.ScreenSelectionOverlay$TooltipOverlay


            putValue(ACTION_COMMAND_KEY, "pickColo");
            // JFormDesigner - End of action initialization  //GEN-END:initComponents
        }

        public void actionPerformed(ActionEvent e) {
            ScreenSelectionOverlay overlay = new ScreenSelectionOverlay(MainWindow.this, true, ScreenSelectionOverlay.CloseMethod.CloseOnClick);
            overlay.addMouseListener(new MouseAdapter() {
                public void mouseClicked(final MouseEvent e) {
                    new Thread() {
                        public void run() {
                            try {
                                Thread.sleep(100); // Delay so the window can hide in time...
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            int col = WindowManager.getDesktop().getPixel(e.getXOnScreen(), e.getYOnScreen()) & 0xffffff; // Only care about rgb...
                            Color c = new Color(col, false);
                            System.out.println(String.format("Selected color: #%06x", col));
                            SnippetManager.instance.addSnippet(c);
                        }
                    }.start();
                }
            });
            overlay.setVisible(true);
        }
View Full Code Here


            putValue(ACTION_COMMAND_KEY, "bitmapSelect");
            // JFormDesigner - End of action initialization  //GEN-END:initComponents
        }

        public void actionPerformed(ActionEvent e) {
            ScreenSelectionOverlay overlay = new ScreenSelectionOverlay(MainWindow.this, false, ScreenSelectionOverlay.CloseMethod.CloseOnRelease);
            overlay.addMouseListener(new MouseAdapter() {
                private Point start
                        ,
                        end;

                public void mousePressed(MouseEvent e) {
                    start = e.getLocationOnScreen();
                    end = start; // in case they release straightway...
                }

                public void mouseReleased(MouseEvent e) {
                    end = e.getLocationOnScreen();
                    final int sX = Math.min(start.x, end.x);
                    final int sY = Math.min(start.y, end.y);
                    int eX = Math.max(start.x, end.x);
                    int eY = Math.max(start.y, end.y);
                    final int w = eX - sX;
                    final int h = eY - sY;

                    new Thread(new Runnable() {
                        public void run() {
                            setProgressEnabled(true);
                            setProgressUnknown();
                            try {
                                Thread.sleep(100); // Delay until the windows are hidden...
                            } catch (InterruptedException e1) {
                                    /**/
                            }
                            Object img = WindowManager.getDesktop().captureImage(sX, sY, w + 1, h + 1).toImage();
                            SnippetManager.instance.addSnippet(img);
                            setProgressEnabled(false);
                        }
                    }).start();
                }
            });
            overlay.setVisible(true);
        }
View Full Code Here

TOP

Related Classes of net.cakenet.jsaton.ui.tools.ScreenSelectionOverlay$TooltipOverlay

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.