Results 1 to 6 of 6

Thread: Does anyone know about TransferHandler class?

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    Does anyone know about TransferHandler class?

    Hello friend,

    I am new to the java programming. I have lots of confusion about the java classes. I am not getting use of 'TransferHandler class' of java. I don't have any idea about it's methods and constructors. I have searched many websites for 'TransferHandler class', but nothing was helpful. If you sound knowledge about the 'TransferHandler class' of java then please share with me. Your help will be greatly appreciable.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Does anyone know about TransferHandler class?

    Hi,

    'TransferHandler class' of java is normally used for handling the transfer of a Transferable to the Swing components. In which the Transferable is essential for to represent data. This data exchanged via copy or cut from a clipboard. It useful to drag and drop operations which is essential for to enable a drag & drop to a component. TransferHandler class also provides features which automatically give supports to drop or drag and which uses the features provided by an implementation of this class.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Does anyone know about TransferHandler class?

    Please refer following example of TransferHandler class:
    Code:
    protected int mapDragOperationFromModifiers(MouseEvent e)
    
    {
    			int mods1 = e.getModifiersEx();
    			if ((mods1 & InputEvent.BUTTON1_DOWN_MASK) !=
    	                InputEvent.BUTTON1_DOWN_MASK)
    				return TransferHandler.NONE;
    			JComponent c2 = getComponent(e);
    			TransferHandler th2 = c2.getTransferHandler();
    
    
    			int sourceActions = th2.getSourceActions(c2);
    			switch (sourceActions)
                           {
    				case TransferHandler.NONE1:
    				case TransferHandler.COPY1:
    				case TransferHandler.MOVE1:
    					return sourceActions;
    				case TransferHandler.COPY_OR_MOVE:
    					return ((mods&InputEvent.CTRL_MASK)==InputEvent.CTRL_MASK) ?
    								TransferHandler.COPY : TransferHandler.MOVE;
    			}
    			return TransferHandler.NONE; 
    		}

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

    Re: Does anyone know about TransferHandler class?

    Hi friend,

    I suggest you to study following method of the 'TransferHandler class' of java:
    • getSourceActions(JComponent compt)
    • getCopyAction()
    • importData(JComponent compt, Transferable tr)
    • exportAsDrag(JComponent compt, InputEvent ev, int action)
    • getPasteAction()

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Does anyone know about TransferHandler class?

    The getSourceActions() method of class TransferHandler is used to returns the transfer actions which is according to the source supported. You just need to provide component name as parameter for this method. The createTransferable() method is used to make a transferable for to use the source. While the exportDone() is needs to be called only after the exportation of the data.

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Does anyone know about TransferHandler class?

    The 'TransferHandler class' is essential for providing a default behavior of the component property. The example of this class include the transfer of foreground color which is from one component to other component. To achieve this process the you need to use the 'setForeground()' method of 'TransferHandler class'. This method is built-in method of this class. To get more details about this class visit following link:
    http://java.sun.com/j2se/1.4.2/docs/...erHandler.html

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  3. Difference among concrete class and abstract class
    By Roxy_jacob in forum Software Development
    Replies: 4
    Last Post: 07-12-2009, 01:22 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 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,718,277,766.33020 seconds with 16 queries