Package org.jdesktop.swingworker

Examples of org.jdesktop.swingworker.SwingWorker


    private void stopWorker(AsyncTreeNode node) {
       
        // Check to see if there is an active worker for the give node. Since
        // this is always called on the AWT Event Thread, we do not need to
        // separately synchronize around the Map of workers.
        SwingWorker worker = workerMap.get(node);
        if (worker != null) {
            worker.cancel(true);
            workerMap.remove(node);
            updateCursor();
        }
    }
View Full Code Here


            mouseListeners.remove(listener);
        }
    }

    public void notifyMouseMotionListeners(final MouseEvent e) {
        SwingWorker worker = new SwingWorker<String, Object>() {

            @Override
            public String doInBackground() {
                if (mouseMotionListeners != null) {
                    e.setSource(this);
                    ListIterator<MouseMotionListener> iter = mouseMotionListeners.listIterator();
                    while (iter.hasNext()) {
                        MouseMotionListener listener = iter.next();

                        switch (e.getID()) {
                            case MouseEvent.MOUSE_MOVED:
                                listener.mouseMoved(e);
                                break;
                            case MouseEvent.MOUSE_DRAGGED:
                                listener.mouseDragged(e);
                                break;
                            default:
                                break;
                        }
                    }
                    iter = null;
                }
                return null;
            }
        };
        worker.execute();
        try {
            worker.get();
        } catch (Exception ie) {
        }
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.swingworker.SwingWorker

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.