Package java.awt.dnd

Examples of java.awt.dnd.DropTargetListener


        });

        this.scrollPane = new JScrollPane(this.panel);

        // Set up drag and drop
        DropTargetListener dropTargetListener = new DropTargetAdapter() {
            public void drop(DropTargetDropEvent event) {
                GraphCanvas.this.drop(event);
            }
        };
        new DropTarget(this.panel, DnDConstants.ACTION_COPY_OR_MOVE, dropTargetListener);
View Full Code Here


        modelChartListFacade = new MultiModelChartFacade();
        addComponentListener(new ResizeListener());
        GridBagLayout layout = new GridBagLayout();
        getContentPane().setLayout(layout);
        // TODO refactor; looks very similar to DesktopPane implementation
        getContentPane().setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY, new DropTargetListener(){
            public void dragEnter(DropTargetDragEvent e) {
                if (e.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                    e.acceptDrag(DnDConstants.ACTION_COPY);
                } else {
                    e.rejectDrag();
View Full Code Here

*/
public class DesktopPane extends JDesktopPane {

    public DesktopPane(final GCViewerGui gcViewer) {
        // TODO refactor; looks very similar to GCDocument implementation
        gcViewer.setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY, new DropTargetListener(){
            public void dragEnter(DropTargetDragEvent e) {
                if (e.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                    e.acceptDrag(DnDConstants.ACTION_COPY);
                } else {
                    e.rejectDrag();
View Full Code Here

        GraphicalEditor graphicalEditor;
        GraphicalEditorUI graphicalEditorUI;
        DrawingViewContainer drawingViewContainer;
        ActionMap actionMap;
        DropTargetListener dropTargetListener;
        ElementLocator elementLocator;

        if (value == null) {
            graphicalEditor = createGraphicalEditor();
        } else {
View Full Code Here

        Interface graphicalEditor;
        UI graphicalEditorUI;
        DrawingViewContainer drawingViewContainer;
        ActionMap actionMap;
        DropTargetListener dropTargetListener;

        if (value == null) {
            graphicalEditor = createGraphicalEditor();
        } else {
            if (!value.getClass().isArray()) {
View Full Code Here

        }
      }
     
    });
   
    DropTargetListener dropTargetSourceListener =
       new DropTargetListener() {

        public void dragEnter(DropTargetDragEvent e) {}

        public void dragExit(DropTargetEvent e) {}

        public void dragOver(DropTargetDragEvent e) {}

        @SuppressWarnings("unchecked")
      public void drop(DropTargetDropEvent e) {
         
          try {
            Transferable tr = e.getTransferable();
            DataFlavor[] flavors = tr.getTransferDataFlavors();
            for (int i = 0; i < flavors.length; i++)
             if (flavors[i].isFlavorJavaFileListType()) {
              // accept drop
              e.acceptDrop (e.getDropAction());
             
              List<File> files = (List<File>) tr.getTransferData(flavors[i]);
              File dropFile = files.get(0);
             
              setFileToTextfields(dropFile);
             
              e.dropComplete(true);
              return;
             }
          } catch (Throwable t) {}
          e.rejectDrop();
        }
       
        public void dropActionChanged(
               DropTargetDragEvent e) {}
      };

    DropTargetListener dropTargetDestinationListener =
      new DropTargetListener() {
     
      public void dragEnter(DropTargetDragEvent e) {}
     
      public void dragExit(DropTargetEvent e) {}
     
View Full Code Here

        }
      }
     
    });
   
    DropTargetListener dropTargetSourceListener =
       new DropTargetListener() {

        public void dragEnter(DropTargetDragEvent e) {}

        public void dragExit(DropTargetEvent e) {}

        public void dragOver(DropTargetDragEvent e) {}

        @SuppressWarnings("unchecked")
      public void drop(DropTargetDropEvent e) {
         
          try {
            Transferable tr = e.getTransferable();
            DataFlavor[] flavors = tr.getTransferDataFlavors();
            for (int i = 0; i < flavors.length; i++)
             if (flavors[i].isFlavorJavaFileListType()) {
              // accept drop
              e.acceptDrop (e.getDropAction());
             
              List<File> files = (List<File>) tr.getTransferData(flavors[i]);
              File dropFile = files.get(0);
             
              setFileToTextfields(dropFile);
             
              e.dropComplete(true);
              return;
             }
          } catch (Throwable t) {}
          e.rejectDrop();
        }
       
        public void dropActionChanged(
               DropTargetDragEvent e) {}
      };

    DropTargetListener dropTargetDestinationListener =
      new DropTargetListener() {
     
      public void dragEnter(DropTargetDragEvent e) {}
     
      public void dragExit(DropTargetEvent e) {}
     
View Full Code Here

        enableEvents(AWTEvent.KEY_EVENT_MASK);          // catch KeyEvents
        enableEvents(AWTEvent.MOUSE_EVENT_MASK);        // catch MouseEvents
        enableEvents(AWTEvent.COMPONENT_EVENT_MASK);    // catch ComponentEvents


        DropTargetListener dropTargetListener = new DropTargetListener() {

            // Die Maus betritt die Komponente mit
            // einem Objekt
            public void dragEnter(DropTargetDragEvent e)
            {
View Full Code Here

         @param dtde The drop event.
         */
        public void dragEnter(DropTargetDragEvent dtde) {
            //notify additionalListeners
            for (int i = 0; i < _additionalListeners.size(); i++) {
                DropTargetListener l = (DropTargetListener) _additionalListeners
                        .elementAt(i);
                l.dragEnter(dtde);
            }

            if (dtde.isDataFlavorSupported(PtolemyTransferable.namedObjFlavor)) {
                dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
            } else {
View Full Code Here

         @param dtde The drop event.
         */
        public void dragExit(DropTargetEvent dtde) {
            //notify additionalListeners
            for (int i = 0; i < _additionalListeners.size(); i++) {
                DropTargetListener l = (DropTargetListener) _additionalListeners
                        .elementAt(i);
                l.dragExit(dtde);
            }
            if (_highlighted != null) {
                _highlighter.renderDeselected(_highlightedFigure);
                _highlighted = null;
                _highlightedFigure = null;
View Full Code Here

TOP

Related Classes of java.awt.dnd.DropTargetListener

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.