Scroll Pane - Drag and Drop

Hello,
I have to scroll panes and movie clips in the one scroll
pane while the other is blank. I wanted the user to be able to drag
the movie clip out of the one scroll pane and drop it into the
blank one. Any ideas? I'm totally lost on this one.
Thank You

Hi Sarojamaly,
According to your description, when you create a Data Source View in BIDS/SSDT, you can't see the tables in the pane. Right?
In this scenario, when creating data source, please make sure you select a correct data provider. For example, it you connect to SQL Server database, you should use
Native OLE DB\SQL Server Native Client. Then please test your connection to the data source.
If the tables still can't be displayed, please make sure you select proper database and the check tables existence in the database.
Best Regards,
Simon Hou
TechNet Community Support

Similar Messages

  • File Drag and Drop in Portfolio

    Is there any way to enable scrolling when dragging and dropping files into a folder that was created inside a Portfolio in the List View?  When converting multiple files from folders, users want to maintain the organization of the files in the same folder hierarchy within a Porfolio.  If dozens of files are converted, you cannot select a few files and drag them into a folder that is not in the view.  Converting the folders individually is inefficient.

    Hello,
    I think you posted this question in the wrong forum: this is one of the Captivate forums and I do not see a relation to it, but can be wrong.
    Lilybiri

  • How to drag and drop tab nodes between tab panes

    I'm working on example from this tutorial( Drag-and-Drop Feature in JavaFX Applications | JavaFX 2 Tutorials and Documentation ). Based on the tutorial I want to drag tabs between two tabs. So far I managed to create this code but I need some help in order to finish the code.
    Source
    tabPane = new TabPane();
    Tab tabA = new Tab();
       Label tabALabel = new Label("Main Component");
    tabPane.setOnDragDetected(new EventHandler<MouseEvent>()
                @Override
                public void handle(MouseEvent event)
                    /* drag was detected, start drag-and-drop gesture*/
                    System.out.println("onDragDetected");
                    /* allow any transfer mode */
                    Dragboard db = tabPane.startDragAndDrop(TransferMode.ANY);
                    /* put a string on dragboard */
                    ClipboardContent content = new ClipboardContent();
                    content.put(DataFormat.PLAIN_TEXT, tabPane);
                    db.setContent(content);
                    event.consume();
    What is the proper way to insert the content of the tab as object? Into the tutorial simple text is transferred. How I must modify this line content.put(DataFormat.PLAIN_TEXT, tabPane);?
    And what is the proper way to insert the tab after I drag the tab:
    Destination
    tabPane.setOnDragDropped(new EventHandler<DragEvent>()
                @Override
                public void handle(DragEvent event)
                    /* data dropped */
                    /* if there is a string data on dragboard, read it and use it */
                    Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasString())
                        //tabPane.setText(db.getString());
                        Tab tabC = new Tab();
                        tabPane.getTabs().add(tabC);
                        success = true;
                    /* let the source know whether the string was successfully
                     * transferred and used */
                    event.setDropCompleted(success);
                    event.consume();
    I suppose that this transfer can be accomplished?
    Ref javafx 2 - How to drag and drop tab nodes between tab panes - Stack Overflow

    I would use a graphic (instead of text) for the Tabs and call setOnDragDetected on that graphic. That way you know which tab is being dragged. There's no nice way to put the Tab itself into the dragboard as it's not serializable (see https://javafx-jira.kenai.com/browse/RT-29082), so you probably just want to store the tab currently being dragged in a property.
    Here's a quick example; it just adds the tab to the end of the current tabs in the dropped pane. If you wanted to insert it into the nearest location to the actual drop you could probably iterate through the tabs and figure the coordinates of each tab's graphic, or something.
    import java.util.Random;
    import javafx.application.Application;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.input.ClipboardContent;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class DraggingTabPane extends Application {
      private static final String TAB_DRAG_KEY = "tab" ;
      private ObjectProperty<Tab> draggingTab ;
    @Override
      public void start(Stage primaryStage) {
      draggingTab = new SimpleObjectProperty<>();
      TabPane tabPane1 = createTabPane();
      TabPane tabPane2 = createTabPane();
      VBox root = new VBox(10);
      root.getChildren().addAll(tabPane1, tabPane2);
      final Random rng = new Random();
      for (int i=1; i<=8; i++) {
        final Tab tab = createTab("Tab "+i);
        final StackPane pane = new StackPane();
          int red = rng.nextInt(256);
          int green = rng.nextInt(256);
          int blue = rng.nextInt(256);
        String style = String.format("-fx-background-color: rgb(%d, %d, %d);", red, green, blue);
        pane.setStyle(style);
        final Label label = new Label("This is tab "+i);
        label.setStyle(String.format("-fx-text-fill: rgb(%d, %d, %d);", 256-red, 256-green, 256-blue));
        pane.getChildren().add(label);
        pane.setMinWidth(600);
        pane.setMinHeight(250);
        tab.setContent(pane);
        if (i<=4) {
          tabPane1.getTabs().add(tab);
        } else {
          tabPane2.getTabs().add(tab);
      primaryStage.setScene(new Scene(root, 600, 600));
      primaryStage.show();
      public static void main(String[] args) {
      launch(args);
      private TabPane createTabPane() {
        final TabPane tabPane = new TabPane();
        tabPane.setOnDragOver(new EventHandler<DragEvent>() {
          @Override
          public void handle(DragEvent event) {
            final Dragboard dragboard = event.getDragboard();
            if (dragboard.hasString()
                && TAB_DRAG_KEY.equals(dragboard.getString())
                && draggingTab.get() != null
                && draggingTab.get().getTabPane() != tabPane) {
              event.acceptTransferModes(TransferMode.MOVE);
              event.consume();
        tabPane.setOnDragDropped(new EventHandler<DragEvent>() {
          @Override
          public void handle(DragEvent event) {
            final Dragboard dragboard = event.getDragboard();
            if (dragboard.hasString()
                && TAB_DRAG_KEY.equals(dragboard.getString())
                && draggingTab.get() != null
                && draggingTab.get().getTabPane() != tabPane) {
              final Tab tab = draggingTab.get();
              tab.getTabPane().getTabs().remove(tab);
              tabPane.getTabs().add(tab);
              event.setDropCompleted(true);
              draggingTab.set(null);
              event.consume();
        return tabPane ;
      private Tab createTab(String text) {
        final Tab tab = new Tab();
        final Label label = new Label(text);
        tab.setGraphic(label);
        label.setOnDragDetected(new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            Dragboard dragboard = label.startDragAndDrop(TransferMode.MOVE);
            ClipboardContent clipboardContent = new ClipboardContent();
            clipboardContent.putString(TAB_DRAG_KEY);
            dragboard.setContent(clipboardContent);
            draggingTab.set(tab);
            event.consume();
        return tab ;

  • Still loose ability to drag and drop files in Project pane.

    In the last two weeks, I've had two instances where I lost
    the ability to drag and drop files within the Project pane.
    However, here's the kicker...the problem doesn't manefest itself
    until after I end my session, close RH, then restart the computer
    and restart the project. That means I don't know that I'm working
    in a broken project until AFTER I've zipped up and saved the
    current project. I tried addressing this in this orum once already
    and I received some suggested fixes (included in the list below)
    but it never fixed and and has happened again.
    Some pieces of information:
    - I've deleted the .xpj and cpd files, no joy.
    - I've regenerated the output, then tried to move a file, no
    joy.
    - I've generated a CHM (supposedy to update other files), no
    joy.
    - I'm not attempting to move a file to a directory where that
    name already exists
    - If while I'm having the problem, I create a nw project, new
    folders, and new topics, they move around fine.
    - If I create a topic IN the directory with the problem, I
    cannot move that file.
    - I've zippd up a broken project and sent it to Adobe. They
    openned it and it was fine. They zipped it back to me and it still
    wasn't.
    - If I create a new project, replicate my directory
    structure, and import the htm files into the new structure (a
    ubdirectory at a time), the files move fine.
    - I'm only working local on Windows 2000 with 30 GB of disk
    space, and I have not installed anything else on the computer in
    the last 2 weeks.
    - I've escalated this to the next level at Adobe and am
    sitting by my phone with my headset waiting for the call back
    "within the next two hours".
    Anyone seen this?

    quote:
    Originally posted by:
    Amebr
    Could the files have somehow been set to read-only?
    I'm not sure on the exact details of your process, but if you
    open the project after unzipping it, perhaps the unzip process has
    changed that file attribute...?
    I appreciate your response, but no...all files and
    directories had all permissions allowed. The zip process wasn't
    involved until aftrer the problem showed itself...I zip just for
    backup with the hope that I never have to go to it. It was my
    working project that lost the ability to move files. It just turns
    out that after it happened and I went to the zip that it showed
    that the problem had affected the files before I zipped them and
    therefore, the zip was of the broken set.

  • Drag and drop icons from onside of the split pane to the other side.

    Hello All,
    I am tring to write a program where i can drag and drop icons from the left side of the split pane to the right side. I have to draw a network on the right side of the split pane from the icons provided on the left side. Putting the icons on the labels donot work as i would like to drag multiple icons from the left side and drop them on the right side. CAn anyone please help me with this.
    Thanks in advance
    smitha

    The other option besides the drag_n_drop support
    http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.htmlis to make up something on your own. You could use a glasspane (see JRootPane api for overview) as mentioned in the tutorial.
    Here's another variation using an OverlayLayout. One advantage of this approach is that you can localize the overlay component and avoid some work.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class DragRx extends JComponent {
        JPanel rightComponent;
        BufferedImage image;
        Point loc = new Point();
        protected void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(image != null)
                g2.drawImage(image, loc.x, loc.y, this);
        public void setImage(BufferedImage image) {
            this.image = image;
            repaint();
        public void moveImage(int x, int y) {
            loc.setLocation(x, y);
            repaint();
        public void dropImage(Point p) {
            int w = image.getWidth();
            int h = image.getHeight();
            p = SwingUtilities.convertPoint(this, p, rightComponent);
            JLabel label = new JLabel(new ImageIcon(image));
            rightComponent.add(label);
            label.setBounds(p.x, p.y, w, h);
            setImage(null);
        private JPanel getContent(BufferedImage[] images) {
            JSplitPane splitPane = new JSplitPane();
            splitPane.setLeftComponent(getLeftComponent(images));
            splitPane.setRightComponent(getRightComponent());
            splitPane.setResizeWeight(0.5);
            splitPane.setDividerLocation(225);
            JPanel panel = new JPanel();
            OverlayLayout overlay = new OverlayLayout(panel);
            panel.setLayout(overlay);
            panel.add(this);
            panel.add(splitPane);
            return panel;
        private JPanel getLeftComponent(BufferedImage[] images) {
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.weightx = 1.0;
            gbc.weighty = 1.0;
            for(int j = 0; j < images.length; j++) {
                gbc.gridwidth = (j%2 == 0) ? GridBagConstraints.RELATIVE
                                           : GridBagConstraints.REMAINDER;
                panel.add(new JLabel(new ImageIcon(images[j])), gbc);
            CopyDragHandler handler = new CopyDragHandler(panel, this);
            panel.addMouseListener(handler);
            panel.addMouseMotionListener(handler);
            return panel;
        private JPanel getRightComponent() {
            rightComponent = new JPanel(null);
            MouseInputAdapter mia = new MouseInputAdapter() {
                Component selectedComponent;
                Point offset = new Point();
                boolean dragging = false;
                public void mousePressed(MouseEvent e) {
                    Point p = e.getPoint();
                    for(Component c : rightComponent.getComponents()) {
                        Rectangle r = c.getBounds();
                        if(r.contains(p)) {
                            selectedComponent = c;
                            offset.x = p.x - r.x;
                            offset.y = p.y - r.y;
                            dragging = true;
                            break;
                public void mouseReleased(MouseEvent e) {
                    dragging = false;
                public void mouseDragged(MouseEvent e) {
                    if(dragging) {
                        int x = e.getX() - offset.x;
                        int y = e.getY() - offset.y;
                        selectedComponent.setLocation(x,y);
            rightComponent.addMouseListener(mia);
            rightComponent.addMouseMotionListener(mia);
            return rightComponent;
        public static void main(String[] args) throws IOException {
            String[] ids = { "-c---", "--g--", "---h-", "----t" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++) {
                String path = "images/geek/geek" + ids[j] + ".gif";
                images[j] = ImageIO.read(new File(path));
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new DragRx().getContent(images));
            f.setSize(500,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class CopyDragHandler extends MouseInputAdapter {
        JComponent source;
        DragRx target;
        JLabel selectedLabel;
        Point start;
        Point offset = new Point();
        boolean dragging = false;
        final int MIN_DIST = 5;
        public CopyDragHandler(JComponent c, DragRx dr) {
            source = c;
            target = dr;
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            Component[] c = source.getComponents();
            for(int j = 0; j < c.length; j++) {
                Rectangle r = c[j].getBounds();
                if(r.contains(p) && c[j] instanceof JLabel) {
                    offset.x = p.x - r.x;
                    offset.y = p.y - r.y;
                    start = p;
                    selectedLabel = (JLabel)c[j];
                    break;
        public void mouseReleased(MouseEvent e) {
            if(dragging && selectedLabel != null) {
                int x = e.getX() - offset.x;
                int y = e.getY() - offset.y;
                target.dropImage(new Point(x,y));
            selectedLabel = null;
            dragging = false;
        public void mouseDragged(MouseEvent e) {
            Point p = e.getPoint();
            if(!dragging && selectedLabel != null
                         && p.distance(start) > MIN_DIST) {
                dragging = true;
                copyAndSend();
            if(dragging) {
                int x = p.x - offset.x;
                int y = p.y - offset.y;
                target.moveImage(x, y);
        private void copyAndSend() {
            ImageIcon icon = (ImageIcon)selectedLabel.getIcon();
            BufferedImage image = copy((BufferedImage)icon.getImage());
            target.setImage(image);
        private BufferedImage copy(BufferedImage src) {
            int w = src.getWidth();
            int h = src.getHeight();
            BufferedImage dst =
                source.getGraphicsConfiguration().createCompatibleImage(w,h);
            Graphics2D g2 = dst.createGraphics();
            g2.drawImage(src,0,0,source);
            g2.dispose();
            return dst;
    }geek images from
    http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html

  • Drag and Drop between JTree and Labels in 2 different panes

    Hi,
    I am using JDK 1.4.1 and am trying to implement Drag n Drop between a JTree and JLabels with ImageIcons, both on different panes.
    I got the DnD working fine on the tree. but i cant get to drag and drop the label from the other pane, on the Jtree as a node. I am getting confused with the DataFlavors, and also wonder if there is something else that i have to do for DnD between 2 panes. Can someone give me any leads on this, please? The Panes I am talking about are splitpanes.
    thanks,
    Sri.

    hey thanks Dennis!! I was hoping you would respond to my question, as I have seen a lot of your replies. yes, the example you gave would be helpful. but i am trying to implement this in 1.4.1, with the new drag and drop in swing. and i am getting confused wiht theh data flavors etc.
    my problem at hand is :
    I have a tree on the left pane. i can drag and drop the nodes on the tree itself. (i already did that...no problem). I have Jlabels with imageicons (actually wrapper classes with labels and imageicons) on the right pane. i have to be able to drag these labels to the tree such that they form a node.
    I have one class the NodeSelection class which extends TransferHandler and implements Transferable. i was able to do DnD for the tree using this. I customized the importData method in this.I thought that i can just use the same class to create the transferhandler and transferable, and just use a different implementation for the importData method if the data being dragged is from the label.
    well, my thoughts and ideas were ok...but i can implement it...so they must be wrong ;-)
    Can u please suggest another way to do this. I have a deadline to meet and am stuck here :-( any suggestions or tips or hints would be very helpful and appreciated!!
    Thanks,
    Sri.

  • Drag and Drop between 2 Panes

    Hi,
    I am using JDK 1.4.1 and am trying to implement Drag n Drop between a JTree and Labels with ImageIcons, both on different panes.
    I got the DnD working just on the tree. but i cant get to drag and drop the label on the Jtree as a node. I am getting confused with the DataFlavors, and also wonder if there is something else that i have to do for DnD between 2 panes. Can someone give me any leads on this, please?
    thanks,
    Sri.

    hey thanks Dennis!! I was hoping you would respond to my question, as I have seen a lot of your replies. yes, the example you gave would be helpful. but i am trying to implement this in 1.4.1, with the new drag and drop in swing. and i am getting confused wiht theh data flavors etc.
    my problem at hand is :
    I have a tree on the left pane. i can drag and drop the nodes on the tree itself. (i already did that...no problem). I have Jlabels with imageicons (actually wrapper classes with labels and imageicons) on the right pane. i have to be able to drag these labels to the tree such that they form a node.
    I have one class the NodeSelection class which extends TransferHandler and implements Transferable. i was able to do DnD for the tree using this. I customized the importData method in this.I thought that i can just use the same class to create the transferhandler and transferable, and just use a different implementation for the importData method if the data being dragged is from the label.
    well, my thoughts and ideas were ok...but i can implement it...so they must be wrong ;-)
    Can u please suggest another way to do this. I have a deadline to meet and am stuck here :-( any suggestions or tips or hints would be very helpful and appreciated!!
    Thanks,
    Sri.

  • Elements 6 scrolling and drag and drop issues.

    In organizer, my mouse will not scroll proberly either by clicking on the up and down arrows or by clicking and pulling the tab. I also connot drag and drop from the tag section to pictures. Can anybody provide a solution.
    Thanks

    I don't think so that the click operations work in the organizer.By the way which mouse are you using?

  • Drag and Drop Scrolling

    When typing in a text box in a web browser, such as blogger or Hotmail, when we try to drag and drop text or images from one location to another that is off-screen, the computer will not automatically scroll when the image is dragged to the bottom of the text box. We are forced to drag to the bottom, scroll down, drag to the bottom, scroll down and repeat until we have it where we want it. Is there an easier way to do this? We are new to Macs, and we never had this problem on our Windows PCs.

    try copying and pasting text
    highlight what you want press cmd+c then choose where you want it to start and press cmd+v
    Regards

  • How to drag and drop an Image between two JPanels inside a Split Pane

    I'm tring to do that, and my actual problem is as follows:
    I drag the Image from the bottomPanel but I can't drop it in the topPanel, I'm using this classes:
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    import java.awt.image.*;
    public class MoveableComponentsContainer extends JSplitPane {     
         public DragSource dragSource;
         public DropTarget dropTarget;
    public JPanel topPanel = new JPanel();
    public JPanel bottomPanel = new JPanel();
         public int ancho;
    public int alto;
    public MoveableLabel lab1,lab2,lab3,lab4;
    public Icon ico1, ico2,ico3,ico4;
    private static BufferedImage buffImage = null; //buff image
         private static Point cursorPoint = new Point();
    public int getMaximumDividerLocation() {
    return ( ( int ) ( alto * .85 ) );
    public int getMinimumDividerLocation() {
    return( ( int ) ( alto * .85 ) );
         public MoveableComponentsContainer(int Weight, int Height ) {
    alto = Height;
    ancho = Weight;
    setOrientation( VERTICAL_SPLIT);
    setDividerSize(2);
    getMaximumDividerLocation();
    getMinimumDividerLocation();
    setPreferredSize(new Dimension( (int) ( Weight * .99 ), (int) ( Height * .94 ) ) );
    setDividerLocation( getMaximumDividerLocation() );
    System.out.println( " getDividerLocation() = " + getDividerLocation() );
    topPanel.setName("topPanel");
    bottomPanel.setName("bottomPanel");
    bottomPanel.setPreferredSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .15 ) ) );
    bottomPanel.setMaximumSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .15 ) ) );
    bottomPanel.setMinimumSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .15 ) ) );
    topPanel. setPreferredSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .85 ) ) );
    topPanel. setMaximumSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .85 ) ) );
    topPanel. setMinimumSize( new Dimension( (int) ( Weight * .99 ), (int) ( ( Height * .94 ) * .85 ) ) );
    bottomPanel.setEnabled(true);
    bottomPanel.setVisible(true);
    bottomPanel.setBackground( new Color( 57,76,123 ) );
    topPanel. setEnabled(true);
    topPanel. setVisible(true);
    topPanel. setBackground( new Color( 57,76,123 ) );
    setBottomComponent( bottomPanel );
    setTopComponent( topPanel );
    setOneTouchExpandable( false );
    bottomPanel.setBorder(BorderFactory.createTitledBorder("Drag and Drop Test"));
              setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.gray));
    bottomPanel.setLayout( new FlowLayout() );
    topPanel.setLayout(new FlowLayout());
              addMoveableComponents();
         private void addMoveableComponents() {
    ico1 = new ImageIcon( "/usr/local/installers/java/lll/DnD/switchm.gif");
    lab1 = new MoveableLabel("Centrales", ico1, topPanel );
    lab1.setName("labelOne");
    bottomPanel.add( lab1 );
              lab2 = new MoveableLabel("Destinos", ico1, topPanel);
    lab2.setName("labelTwo");
              bottomPanel.add( lab2 );
              lab3 = new MoveableLabel("Registros", ico1, topPanel );
    lab3.setName("labelThree");
              bottomPanel.add( lab3 );
              lab4 = new MoveableLabel("Parametros", ico1, topPanel);
    lab4.setName("labelFour");
              bottomPanel.add( lab4 );
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    public class MoveableLabel extends JLabel implements Transferable {
    final static int FILE = 0;
    final static int STRING = 1;
    final static int IMAGE = 2;
    DataFlavor flavors[] = { DataFlavor.javaFileListFlavor,
    DataFlavor.stringFlavor,
    DataFlavor.imageFlavor };
    public JPanel PanelDestino;
    public JPanel PanelOrigen;
    public DropTarget dropTarget;
    public DropTargetListener dropTargetLis;
         private static final Border border = BorderFactory.createLineBorder(Color.black, 1);
         public MoveableLabel(String text, Icon ic, JPanel DestPanel) {
              super( text, ic, TRAILING);
    PanelDestino = DestPanel;
              MouseEventForwarder forwarder = new MouseEventForwarder();
              addMouseListener(forwarder);
              addMouseMotionListener(forwarder);
              setBorder(border);
              setBounds(0,0,50,100);
              setOpaque(true);
    setTransferHandler(new TransferHandler("text"));
    setBackground( new Color( 57,76,123 ) );
    public synchronized DataFlavor[] getTransferDataFlavors() {
         return flavors;
    public boolean isDataFlavorSupported(DataFlavor flavor) {
    boolean b = false;
    b |= flavor.equals(flavors[ FILE ]);
    b |= flavor.equals(flavors[STRING]);
    b |= flavor.equals(flavors[ IMAGE]);
    return (b);
    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, java.io.IOException {
    return this;
         final class MouseEventForwarder extends MouseInputAdapter {
              public void mousePressed(MouseEvent e) {
                   Container parent = getParent();
    Container brother = (Container)PanelDestino;
    System.out.println( "Parent 1 = " + parent.getName() );
    System.out.println( "Destino 1 = " + brother.getName() );
    JComponent c = (JComponent) e.getSource();
    System.out.println( "getsource() = " + c.getName() );
    TransferHandler th = c.getTransferHandler();
    th.exportAsDrag( c, e, TransferHandler.COPY_OR_MOVE );
    dropTarget = getDropTarget();
    System.out.println( "dropTarget.getComponent().getName() = " + dropTarget.getComponent().getName() );
    for ( int a=0; a < parent.getComponentCount(); a++ ) {
    parent.getComponent( a ).setEnabled( false );
    brother.setDropTarget( dropTarget );
    System.out.println( "dropTarget.getComponent().getName() = " + dropTarget.getComponent().getName() );
              public void mouseReleased(MouseEvent e) {
                   Container parent = getParent();
    Container brother = PanelDestino;
    System.out.println( "Parent 2 = " + parent.getName() );
    System.out.println( "Destino 2 = " + PanelDestino.getName() );
    parent.setEnabled( true );
    brother.setEnabled( false );
    for ( int a=0; a < parent.getComponentCount(); a++ ) {
    parent.getComponent( a ).setEnabled( true );
    import java.awt.*;
    import javax.swing.*;
    public class TestDragComponent extends JFrame {
         public TestDragComponent() {
    super("TestDragComponent");
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension dm = new Dimension();
    dm = tk.getScreenSize();
    System.out.println(dm.height);
    System.out.println(dm.width );
    Container cntn = getContentPane();
    cntn.setFont(new Font("Helvetica", Font.PLAIN, 14));
    cntn.add(new MoveableComponentsContainer(dm.width,dm.height));
              pack();
              setVisible(true);
         public static void main(String[] args) {
              new TestDragComponent();

    Ok I found the answer to your problem. If you download the tutorial they have the code there it's in one folder. I hope this helps.
    http://java.sun.com/docs/books/tutorial/

  • Drag and drop in jscrollpane

    Hi all
    I have 2 different scrollpanes setup in 2 different panels. one of them contains a rdf graph structure which is generated by me using several other APIs. Now I want to drag and drop some of the nodes from one scroll pane to another. The nodes have features to be selected. I am totally new to java drag n drop. Can some one help me by providing some basic code to move stuff between scrollpanes??

    No, I do not (and cannot) use TransferHandler and such. The Drag and Drop is done manually by using MouseListener and MouseMotionListener.
    And also, my problem is not the drag and drop functionality. The problem is only the scrolling.

  • Drag and Drop to photo page creates links, doesn't replace placeholders

    I searched the discussions for quite a while and didn't find much similar to this topic. Basically, drag and drop is no longer working on my iWeb and my photo grids will not accept pictures to replace the placeholder (sample) photos. I will try to explain the whole problem in detail.
    I am a new iWeb user, and I set up a page without any problems at first. Yet when I returned in iWeb to add another photo page today, I have had a lot of trouble. I used the template Photo Page and opened the Inspector and the Media Viewer to drag photos onto the placeholder photos, as the Help pages and tutorials show. Yet when I drag the picture file from the Media Viewer into the photo grid, only a small text box appears that sets up a hyperlink to the photo file on my computer. I've tried messing with the inspector, seeing what the difference is between the placeholder photos' settings and the files I'm trying to add.
    The only differences I can see are: in the Link Inspector's pane I can tell the program is at first making a hyperlink to the file instead of displaying the photo (yet disabling the hyperlink doesn't change anything); also,
    In the Graphic Inspector pane that appears when I have selected a general area in the photo grid, at the top the "Style" , "Layout" and "Caption" options appear, along with a display of a sample photo style. When I click on one of the rectangles that appears with the file I am trying to drag and drop, I have only the "fill" option, which has "none" selected. Fiddling with the options does not get the photo to appear.
    I can see the blue grid surrounding the placeholder photos, so the photo grid exists. I have also tried using different templates' photo pages, but they all have the same problem. I also tried creating an album in iPhoto and importing it to iWeb, but only two photos appeared out of 12.
    So the main part of my problem is not that photos don't appear at all (if I try and insert them they appear on their own, completely independant of the template's style and the photo grid)., it is that they do not work with the photo grid and that drag-and-drop no longer works.
    Any information that could help is greatly appreciated.
    Sue

    Susan,
    Try out the following things. These suggestions are
    sort of the starting point for non-specific strange
    behavior in iWeb.
    1. Delete iWeb preference file at:
    YourHardDrive/Users/yourname/Users/Library/Preferences
    /"com.apple.iWeb.plist"
    2. Delete iLife Media Browser preference file at:
    YourHardDrive/Library/Preferences/"com.apple.iLifeMedi
    aBrowser.plist"
    3. Repair startup disk permissions using Disk
    Utility
    4. Reboot machine
    5. Delete iWeb application (but keep a backup of the
    Domain file!) and reinstall iWeb 1.0 from original
    iLife'06 DVD or Recovery Disks and then update
    directly to 1.1.1 via Software Update.
    These are the top 5 things that seem to garner some
    kind of positive results from people having similar
    problems.
    I am having the same problem Susan described. I've tried #1 and #2 from the above recommendations and still have the same problem of photos not opening in the photo page after dragging them from iphoto. I, too, published a site (not on .Mac, but I don't know if that matters) and now want to add a photo page. Also, the template shows six placeholders, but when I select the photo page only three appear.
    Hope you can help. Thank you.

  • Desktop drag and drop icon for my "other" computer

    i really need an icon for my MacBookPro desktop to reside on my Mac Pro desktop (and vice versa) so that I can just drag and drop copy (or move) data from one volume to another. sort of like what I have with my dropbox icon in the sense that I can just keep this on my desktop and in the View Pane of Finder and drag and drop items or open the volume etc.
    is this possible and i am just not getting it to work because i don't have things set to mount automatically or is there a restriction that does not allow this that I don't understand?
    i am on snow leopard and the connection is via wi, but I could plug in via ethernet when i know i will need to do this sort of moving of data a lot.
    thanks for clearing any of this up for me.
    - jon

    if as3, create a sprite or movieclip and use:
    image1.addEventListener(MouseEvent.MOUSE_DOWN,downF);
    image1.addEventListener(MouseEvent.MOUSE_UP,upF);
    function downF(e:MouseEvent):void{
    Sprite(e.currentTarget).startDrag();
    function upF(e:MouseEvent):void{
    Sprite(e.currentTarget).stopDrag();

  • Trying to drag and drop a text parameter, but it only applies to one letter

    Hiya,
    In Motion 3, you could drag and drop a Text - Style Parameter to another text object.
    Now, in Motion 4, when I try to drag a Parameter it only applies to the first letter of my text object.
    So when I drag my Glow from one object to another, my Bleary In Behavior has a blue glow on T in THIS and a yellow glow on HIS in THIS.
    I'm guessing this has to do with the ability to adjust each letter with the glyph tool. However, it won't allow me to drag the Parameter to each individual letter...
    Which I see a need for...
    But why would I want to do a time consuming thing like that?
    It's stupid.
    Any advice is much appreciated!
    Thank you

    Well, I'm not sure what to say. I can't replicate your problem. I can drag the outline parameters onto a text object in the viewer, layers pane, or timeline and it copies it exactly as it did in Motion 3, over the entire text object.
    However, if I have the glyph tool selected and try to do the same thing, it crashes Motion 100% of the time.
    Neither situation is what you're reporting though. It helped me find a bug, and something to avoid however.
    Andy

  • Must click then click and drag for JTable Drag and Drop

    Hi All,
    I've been using Java 1.4 to drag and drop data between two tables in our application. Basically I need to drag the data from individual rows of the source table and insert it into one of the cells in the new table. This works absolutely fine and has made a huge improvement to this portion of our app. I've included example source code below that does a similar thing by transferring data from one table and inserting it into another (it's quite big and also not as well done as the example in our real app but unfortunately I can't send the source for that).
    The thing I've noticed though is that in order to start dragging data I need to click to select it and then press and hold the mouse button to start dragging, whereas under W**dows and just about every other OS you can just press and hold and start dragging straight away. If you try this with a JTable though it just changes the rows you have selected so the drag and drop works but feels a bit clunky and amateurish. I'd like to do something about this such that it works like Windows Explorer (or similar) where you can just press the mouse button and start dragging.
    Any help would be greatly appreciated - and if anybody finds the code useful you're more than welcome to it. Note that the business end of this is CustomTransferHandler.java - this will show you how to insert data at a specific position in a JTable, it's a bit of a faff but not too bad once you've got it sussed.
    Thanks,
    Bart Read
    ===============================================================
    TestFrame.java
    * TestFrame.java
    * Created on October 21, 2002, 4:59 PM
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.event.*;
    import java.util.TooManyListenersException;
    import javax.swing.*;
    * @author  readb
    public class TestFrame extends javax.swing.JFrame
         private static final String [] NAMES     = {
              "John", "Geoff", "Madeleine", "Maria", "Flanders",
              "Homer", "Marge", "Bart", "Lisa", "Weird Baby" };
         private JTable source;
         private JTable dest;
         private MyTableModel     sourceModel;
         private MyTableModel     destModel;
         private Clipboard          clipboard;
         /** Creates a new instance of TestFrame */
         public TestFrame()
              clipboard = getToolkit().getSystemClipboard();
              Container c = getContentPane();
              c.setLayout( new BorderLayout( 40, 40 ) );
              source = new MyJTable();
              sourceModel = new MyTableModel();
              source.setModel( sourceModel );
              source.setDragEnabled( true );
              CustomTransferHandler handler = new CustomTransferHandler( "Source handler" );
              source.setTransferHandler( handler );
              try
                   source.getDropTarget().addDropTargetListener( handler );
              catch ( TooManyListenersException tmle )
                   tmle.printStackTrace();
              dest = new MyJTable();
              destModel = new MyTableModel();
              dest.setModel( destModel );
              dest.setDragEnabled( true );
              handler = new CustomTransferHandler( "Dest handler" );
              dest.setTransferHandler( handler );
              try
                   dest.getDropTarget().addDropTargetListener( handler );
              catch ( TooManyListenersException tmle )
                   tmle.printStackTrace();
              c.add( new JScrollPane( source ), BorderLayout.WEST );
              c.add( new JScrollPane( dest ), BorderLayout.EAST );
              populate();
         private void populate( MyTableModel model )
              for ( int index = 0; index < NAMES.length; ++index )
                   model.setRow( index, new DataRow( index + 1, NAMES[ index ] ) );
         private void populate()
              populate( sourceModel );
              populate( destModel );
         public static void main( String [] args )
              TestFrame app = new TestFrame();
              app.addWindowListener(
                   new WindowAdapter() {
                        public void windowClosing( WindowEvent we )
                             System.exit( 0 );
              app.pack();
              app.setSize( 1000, 600 );
              app.show();
         private class MyJTable extends JTable
              public boolean getScrollableTracksViewportHeight()
                   Component parent = getParent();
                   if (parent instanceof JViewport)
                        return parent.getHeight() > getPreferredSize().height;
                   return false;
    }=====================================================================
    MyTableModel.java
    * MyTableModel.java
    * Created on October 21, 2002, 4:43 PM
    import java.util.ArrayList;
    * @author  readb
    public class MyTableModel extends javax.swing.table.AbstractTableModel
         private static final int          NUMBER               = 0;
         private static final int          NAME               = 1;
         private static final String []     COLUMN_HEADINGS     = { "Number", "Name" };
         private ArrayList data;
         /** Creates a new instance of MyTableModel */
         public MyTableModel()
              super();
              data = new ArrayList();
         public int getColumnCount()
              return COLUMN_HEADINGS.length;
         public String getColumnName( int index )
              return COLUMN_HEADINGS[ index ];
         public Class getColumnClass( int index )
              switch ( index )
                   case NUMBER:
                        return Integer.class;
                   case NAME:
                        return String.class;
                   default:
                        throw new IllegalArgumentException( "Illegal column index: " + index );
         public int getRowCount()
              return ( null == data ? 0 : data.size() );
         public Object getValueAt( int row, int column )
              DataRow dataRow = ( DataRow ) data.get( row );
              switch ( column )
                   case NUMBER:
                        return new Integer( dataRow.getNumber() );
                   case NAME:
                        return dataRow.getName();
                   default:
                        throw new IllegalArgumentException( "Illegal column index: " + column );
         public void addRow( DataRow row )
              int rowIndex = data.size();
              data.add( row );
              fireTableRowsInserted( rowIndex, rowIndex );
         public void addRows( DataRow [] rows )
              int firstRow = data.size();
              for ( int index = 0; index < rows.length; ++index )
                   data.add( rows[ index ] );
              fireTableRowsInserted( firstRow, data.size() - 1 );
         public void setRow( int index, DataRow row )
              if ( index == data.size() )
                   data.add( row );
              else
                   data.set( index, row );
              fireTableRowsUpdated( index, index );
         public void insertRows( int index, DataRow [] rows )
              for ( int rowIndex = rows.length - 1; rowIndex >= 0; --rowIndex )
                   data.add( index, rows[ rowIndex ] );
              fireTableRowsInserted( index, index + rows.length - 1 );
         public DataRow getRow( int index )
              return ( DataRow ) data.get( index );
         public DataRow removeRow( int index )
              DataRow retVal = ( DataRow ) data.remove( index );
              fireTableRowsDeleted( index, index );
              return retVal;
         public boolean removeRow( DataRow row )
              int index = data.indexOf( row );
              boolean retVal = data.remove( row );
              fireTableRowsDeleted( index, index );
              return retVal;
         public void removeRows( DataRow [] rows )
              for ( int index = 0; index < rows.length; ++index )
                   data.remove( rows[ index ] );
              fireTableDataChanged();
    }=====================================================================
    DataRow.java
    * DataRow.java
    * Created on October 21, 2002, 4:41 PM
    import java.io.Serializable;
    * @author  readb
    public class DataRow implements Serializable
         private int          number;
         private String     name;
         /** Creates a new instance of DataRow */
         public DataRow( int number, String name )
              this.number = number;
              this.name = name;
         public int getNumber()
              return number;
         public String getName()
              return name;
         public String toString()
              return String.valueOf( number ) + ": " + name;
    }======================================================================
    CustomTransferHandler.java
    * CustomTransferHandler.java
    * Created on October 22, 2002, 8:36 AM
    import java.awt.*;
    import java.awt.datatransfer.Clipboard;
    import java.awt.datatransfer.ClipboardOwner;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.datatransfer.UnsupportedFlavorException;
    import java.awt.dnd.*;
    import java.awt.event.InputEvent;
    import java.io.IOException;
    import java.util.Arrays;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JComponent;
    import javax.swing.JTable;
    import javax.swing.TransferHandler;
    * @author  readb
    public class CustomTransferHandler
                   extends TransferHandler
                   implements Transferable, ClipboardOwner, DropTargetListener
         public static final DataFlavor     ROW_ARRAY_FLAVOR     = new DataFlavor( DataRow[].class, "Multiple rows of data" );
         private String               name;
         private ImageIcon          myIcon;
         private     DataRow []          data;
         private boolean               clipboardOwner                    = false;
         private int                    rowIndex                         = -1;
         /** Creates a new instance of CustomTransferHandler */
         public CustomTransferHandler( String name )
              this.name = name;
         public boolean canImport( JComponent comp, DataFlavor [] transferFlavors )
              System.err.println( "CustomTransferHandler::canImport" );
              if ( comp instanceof JTable && ( ( JTable ) comp ).getModel() instanceof MyTableModel )
                   for ( int index = 0; index < transferFlavors.length; ++index )
                        if ( ! transferFlavors[ index ].equals( ROW_ARRAY_FLAVOR ) )
                             return false;
                   return true;
              else
                   return false;
         protected Transferable createTransferable( JComponent c )
              System.err.println( "CustomTransferHandler::createTransferable" );
              if ( ! ( c instanceof JTable ) || ! ( ( ( JTable ) c ).getModel() instanceof MyTableModel ) )
                   return null;
              this.data = null;
              JTable               table     = ( JTable ) c;
              MyTableModel     model     = ( MyTableModel ) table.getModel();
              Clipboard          cb          = table.getToolkit().getSystemClipboard();
              cb.setContents( this, this );
              clipboardOwner = true;
              int [] selectedRows = table.getSelectedRows();
              Arrays.sort( selectedRows );
              data = new DataRow[ selectedRows.length ];
              for ( int index = 0; index < data.length; ++index )
                   data[ index ] = model.getRow( selectedRows[ index ] );
              return this;
         public void exportAsDrag( JComponent comp, InputEvent e, int action )
              super.exportAsDrag( comp, e, action );
              Clipboard          cb          = comp.getToolkit().getSystemClipboard();
              cb.setContents( this, this );
         protected void exportDone( JComponent source, Transferable data, int action )
              System.err.println( "CustomTransferHandler::exportDone" );
              if ( TransferHandler.MOVE == action && source instanceof JTable && ( ( JTable ) source ).getModel() instanceof MyTableModel )
                   JTable table = ( JTable ) source;
                   MyTableModel model = ( MyTableModel ) table.getModel();
                   int [] selected = table.getSelectedRows();
                   for ( int index = selected.length - 1; index >= 0; --index )
                        model.removeRow( selected[ index ] );
         public void exportToClipboard( JComponent comp, Clipboard clip, int action )
              System.err.println( "CustomTransferHandler::exportToClipboard" );
         public int getSourceActions( JComponent c )
              System.err.println( "CustomTransferHandler::getSourceActions" );
              if ( ( c instanceof JTable ) && ( ( JTable ) c ).getModel() instanceof MyTableModel )
                   return MOVE;
              else
                   return NONE;
          *     I've commented this out because it doesn't appear to work in any case.
          *     The image isn't null but as far as I can tell this method is never
          *     invoked.
    //     public Icon getVisualRepresentation( Transferable t )
    //          System.err.println( "CustomTransferHandler::getVisualRepresentation" );
    //          if ( t instanceof CustomTransferHandler )
    //               if ( null == myIcon )
    //                    try
    //                         myIcon = new ImageIcon( getClass().getClassLoader().getResource( "dragimage.gif" ) );
    //                    catch ( Exception e )
    //                         System.err.println( "CustomTransferHandler::getVisualRepresentation: exception loading image" );
    //                         e.printStackTrace();
    //                    if ( null == myIcon )
    //                         System.err.println( "CustomTransferHandler::getVisualRepresentation: myIcon is still NULL" );
    //               return myIcon;
    //          else
    //               return null;
         public boolean importData( JComponent comp, Transferable t )
              System.err.println( "CustomTransferHandler::importData" );
              super.importData( comp, t );
              if ( ! ( comp instanceof JTable ) )
                   return false;
              if ( ! ( ( ( JTable ) comp ).getModel() instanceof MyTableModel ) )
                   return false;
              if ( clipboardOwner )
                   return false;
              if ( !t.isDataFlavorSupported( ROW_ARRAY_FLAVOR ) )
                   return false;
              try
                   data = ( DataRow [] ) t.getTransferData( ROW_ARRAY_FLAVOR );
                   return true;
              catch ( IOException ioe )
                   data = null;
                   return false;
              catch ( UnsupportedFlavorException ufe )
                   data = null;
                   return false;
         public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
              System.err.println( "MyTransferable::getTransferData" );
              if ( flavor.equals( ROW_ARRAY_FLAVOR ) )
                   return data;
              else
                   throw new UnsupportedFlavorException( flavor );
         public DataFlavor[] getTransferDataFlavors()
              System.err.println( "MyTransferable::getTransferDataFlavors" );
              DataFlavor [] flavors = new DataFlavor[ 1 ];
              flavors[ 0 ] = ROW_ARRAY_FLAVOR;
              return flavors;
         public boolean isDataFlavorSupported( DataFlavor flavor )
              System.err.println( "MyTransferable::isDataFlavorSupported" );
              return flavor.equals( ROW_ARRAY_FLAVOR );
         public void lostOwnership( Clipboard clipboard, Transferable transferable )
              clipboardOwner = false;
         /** Called while a drag operation is ongoing, when the mouse pointer enters
          * the operable part of the drop site for the <code>DropTarget</code>
          * registered with this listener.
          * @param dtde the <code>DropTargetDragEvent</code>
         public void dragEnter(DropTargetDragEvent dtde)
         /** Called while a drag operation is ongoing, when the mouse pointer has
          * exited the operable part of the drop site for the
          * <code>DropTarget</code> registered with this listener.
          * @param dte the <code>DropTargetEvent</code>
         public void dragExit(DropTargetEvent dte)
         /** Called when a drag operation is ongoing, while the mouse pointer is still
          * over the operable part of the drop site for the <code>DropTarget</code>
          * registered with this listener.
          * @param dtde the <code>DropTargetDragEvent</code>
         public void dragOver(DropTargetDragEvent dtde)
         /** Called when the drag operation has terminated with a drop on
          * the operable part of the drop site for the <code>DropTarget</code>
          * registered with this listener.
          * <p>
          * This method is responsible for undertaking
          * the transfer of the data associated with the
          * gesture. The <code>DropTargetDropEvent</code>
          * provides a means to obtain a <code>Transferable</code>
          * object that represents the data object(s) to
          * be transfered.<P>
          * From this method, the <code>DropTargetListener</code>
          * shall accept or reject the drop via the
          * acceptDrop(int dropAction) or rejectDrop() methods of the
          * <code>DropTargetDropEvent</code> parameter.
          * <P>
          * Subsequent to acceptDrop(), but not before,
          * <code>DropTargetDropEvent</code>'s getTransferable()
          * method may be invoked, and data transfer may be
          * performed via the returned <code>Transferable</code>'s
          * getTransferData() method.
          * <P>
          * At the completion of a drop, an implementation
          * of this method is required to signal the success/failure
          * of the drop by passing an appropriate
          * <code>boolean</code> to the <code>DropTargetDropEvent</code>'s
          * dropComplete(boolean success) method.
          * <P>
          * Note: The data transfer should be completed before the call  to the
          * <code>DropTargetDropEvent</code>'s dropComplete(boolean success) method.
          * After that, a call to the getTransferData() method of the
          * <code>Transferable</code> returned by
          * <code>DropTargetDropEvent.getTransferable()</code> is guaranteed to
          * succeed only if the data transfer is local; that is, only if
          * <code>DropTargetDropEvent.isLocalTransfer()</code> returns
          * <code>true</code>. Otherwise, the behavior of the call is
          * implementation-dependent.
          * <P>
          * @param dtde the <code>DropTargetDropEvent</code>
         public void drop(DropTargetDropEvent dtde)
              System.err.println( "CustomTransferHandler::drop" );
              Component c = dtde.getDropTargetContext().getDropTarget().getComponent();
              if ( ! ( c instanceof JComponent ) )
                   dtde.rejectDrop();
                   return;
              JComponent comp = ( JComponent ) c;
              if ( ! ( c instanceof JTable ) || ! ( ( ( JTable ) c ).getModel() instanceof MyTableModel ) )
                   dtde.rejectDrop();
                   return;
              dtde.acceptDrop( TransferHandler.MOVE );
              //     THIS is such a mess -- you can't do the following because
              //     getTransferable() throws an (undocumented) exception - what's that
              //     all about.
    //          Transferable t = dtde.getTransferable();
    //               if ( !t.isDataFlavourSupported( ROW_ARRAY_FLAVOR ) )
    //                    dtde.rejectDrop();
    //                    return false;
    //          TransferHandler handler = comp.getTransferHandler();
    //          if ( null == handler || ! handler.importData( comp, t ) )
    //               dtde.rejectDrop();
    //               return;
              Point p = dtde.getLocation();
              JTable table = ( JTable ) comp;
              rowIndex = table.rowAtPoint( p );
              //     So you have to do this instead and use the data that's been
              //     stored in the data member via import data.  Total mess.
              if ( null == data )
                   dtde.rejectDrop();
                   return;
              MyTableModel model = ( MyTableModel ) table.getModel();
              if ( rowIndex == -1 )
                   model.addRows( data );
              else
                   model.insertRows( rowIndex, data );
              dtde.acceptDrop( TransferHandler.MOVE );
         /** Called if the user has modified
          * the current drop gesture.
          * <P>
          * @param dtde the <code>DropTargetDragEvent</code>
         public void dropActionChanged(DropTargetDragEvent dtde)
    }

    Hi again,
    Well I've tried using the MouseListener / MouseMotionListener approach but it doesn't quite seem to work, although it does get the events correctly. I think the reason is that it doesn't interact correctly with the Java DnD machinery which is something that V.V hinted at. It's something that I may need to look into if / when I have more time available.
    I have to say though that I haven't had any problems with scrollbars - we're making fairly heavy use of large tables and if you drag over a table with a scroll bar and move to the top or bottom then it scrolls as you would expect and allows you to drop the data where you like. For this situation I've used pretty much the same approach as for the toy example above except that I've implemented separate source and destination TransferHandlers (the source table is read-only, and it really doesn't make sense to allow people to drag from the destination table so I've essentially split the functionality of the example handler down the middle).
    I'm not actually particularly in favour of messing too much with the mechanics of DnD, more because of lack of time than anything else. Guess I'll just have to put up with this for the moment. Doesn't help that DnD is so poorly documented by Sun.
    Thanks for all your help.
    Bart

Maybe you are looking for

  • HT201250 Why won't Time Machine won't restore my iphoto library [says there is not enough room on my hard drive.]  Any ideas?

    I've got 20,000 plus photos on my HD [yes, I know, way tooo many].  I'm trying to clean up by storing them on an external HD, but for several months I've not been able to export iphoto [even geniuses can't figure out why].  So as a work around, I'm t

  • Reverse type on image

    I have a photoshop image that shows a cardboard box on it's side, opened at one end. The opended end is facing the camera. From the front you can see the top of the box. On the top of the box is printed copy directly on the box. Client wants to flip

  • Variables with wildcard

    hi, can some explain following code.what is the difference between these 3 variables. List<? extends Animal> li1= new ArrayList<Animal>(); List<? super Animal> li2= new ArrayList<Animal>(); List<?> li3= new ArrayList<Animal>(); Edited by: dvrajitha o

  • BAPI or any Function Modules for XD02 functionality

    Hello Experts, I would like to ask if there's any BAPI or Function Module that has the functionality of transaction XD02 - whereas a sales area will be created for customers (entry in KNVV)? My requirement is there a background job that should create

  • ADE crashes when opening .ACSM file on Mac OSX 10.10.2 (and other OS versions)

    I'm trying to use Adobe Digital Editions 4.0.3 to access downloaded ebooks from my public library. Whenever I import the downloaded .ACSM file, ADE crashes. I reopen it, and the book is there -- when I try to open it, it crashes. I try to transfer it