Results 1 to 5 of 5

Thread: How to Choose the Drop Action?

  1. #1
    Join Date
    Aug 2006
    Posts
    122

    How to Choose the Drop Action?

    Hi friends,
    I have started recently with the Java. In that i have started the Drop Action and the methods related to it.!! But I am confused in choosing that.!! So anyone can explain me how to Choose the Drop Action.?? hope that you got my point.!! Please help me soon..
    As you simplify your life, the laws of the universe will be simpler; solitude will not be solitude, poverty will not be poverty, nor weakness.Henry David Thoreau

  2. #2
    Join Date
    Nov 2008
    Posts
    1,192

    Re: How to Choose the Drop Action?

    The set of actions are advertised when exporting data. The source actions are advertised through the getSourceActions method, for Swing components. A method to query the actual drop action that TransferHandler will use. A method to query the source's drop actions, so you know which actions are supported. A way to explicitly choose the actual drop action.

  3. #3
    Join Date
    Mar 2008
    Posts
    349

    Re: How to Choose the Drop Action?

    The TransferHandler for the copy-only target can be coded to only accept data from the source using the setDropAction method, even if the user has indicated a preference for a move action. When a drag is initiated, the user has some control over which of the source actions is chosen for the transfer by way of keyboard modifiers used in conjunction with the drag gesture which is called as user action. The user action indicates a preference, but ultimately it is the target that decides the drop action.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: How to Choose the Drop Action?

    Just have a look at the following code which may help you a lot :
    Code:
    public boolean canImport(TransferHandler.TransferSupport support) {
        if (!support.isDrop()) {
            return false;
        }
    
        if (!support.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            return false;
        }
    
        boolean copySupported = (COPY & support.getSourceDropActions()) == COPY;
        if (copySupported) {
            support.setDropAction(COPY);
            return true;
        }
    
        return false;
    }

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to Choose the Drop Action?

    If you are writing the proper code, the setDropAction method is invoked to ensure that only a copy action will take place and the method returns true. The FromTransferHandler, attached to the source list, allows for dragging from the list and supports both copy and move actions. If you try to drop onto this list, the drop will be rejected because FromTransferHandler has not implemented the canImport and importData methods.

Similar Threads

  1. How to remove "drop in savings" drop down from Google Chrome
    By Echa in forum Technology & Internet
    Replies: 7
    Last Post: 03-03-2012, 10:57 AM
  2. Replies: 3
    Last Post: 14-12-2011, 11:13 AM
  3. Drop In/Drop Out Split Screen in Resistance 3
    By Bubboy in forum Video Games
    Replies: 5
    Last Post: 20-08-2011, 10:48 PM
  4. Need for Speed World frame rate drop frame rate drop
    By Gajanand in forum Video Games
    Replies: 6
    Last Post: 29-07-2010, 04:13 AM
  5. SLI in Action
    By mavilla in forum Monitor & Video Cards
    Replies: 78
    Last Post: 08-01-2005, 06:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,766,117.90580 seconds with 16 queries