Results 1 to 2 of 2
  1. #1
    givmefive5 is offline Member
    Join Date
    Jun 2013
    Rep Power

    Default Removing Drop Function after adding TransferHandler in Button

    Java Code:
    TransferHandler transfer = new TransferHandler("text");
     JButton button = (JButton)e.getSource();
                    TransferHandler handle = button.getTransferHandler();
                    handle.exportAsDrag(button, e, TransferHandler.COPY);
    With the current implementation, I can drag the text inside the buttons to other components. The original plan was only to be able to drag it to JPanels, but because of TransferHandlers, the buttons themselves can receive dropped objects, and worse, if it receives a string, it changes the displayed text on that button to the string that was dropped.

    I need help as to how to disable the ability of the button to catch a dropped object or at least disable the automatic changing of the text displayed. Thank you very much!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Removing Drop Function after adding TransferHandler in Button

    Can you post a SSCCE (a small complete program that compiles, executes and shows the problem)?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. removing from a hashmap and adding to the end
    By dogeatdogfood in forum New To Java
    Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  2. Adding a sqrt button and percentage button to a calculator
    By Josie_Taylor in forum New To Java
    Replies: 4
    Last Post: 03-14-2011, 02:16 AM
  3. drag and drop with click function
    By zwanz in forum AWT / Swing
    Replies: 1
    Last Post: 05-18-2010, 10:56 PM
  4. need help in removing textboxes using button
    By need_help_in_java_badly in forum New To Java
    Replies: 2
    Last Post: 12-10-2009, 09:14 AM
  5. Replies: 0
    Last Post: 08-27-2009, 05:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts