Results 1 to 4 of 4
  1. #1
    Ada
    Ada is offline Member
    Join Date
    May 2007
    Posts
    8
    Rep Power
    0

    Default Is it possible to disable drop in a component?

    I have a drag enabled component in my app. Is it possible to disable the drop part? I mean, I'd like to be able to drag elements from this component but I don't want to be able to drop items on it.

    Thanks in advance.

  2. #2
    levent Guest

    Default

    As described in the Drag and Drop tutorial, you should replace the default transfer handler of the component.

    See: Introduction to Drag and Drop and Data Transfer (The Java™ Tutorials > Creating a GUI with JFC/Swing > Drag and Drop and Data Transfer) for an example.

  3. #3
    Ada
    Ada is offline Member
    Join Date
    May 2007
    Posts
    8
    Rep Power
    0

    Default

    Yes, I know it. I replaced the default transferhandler with my own. I have two JLists, I need to disable the drop component in the first JList and the the drag component in the second one, so I can only drag items from the first list to the second one, and not the other way around. Is it possible?

  4. #4
    levent Guest

    Default

    Of course it is... if you had read the tutorial you wouldn't ask for it, but here are useful links:

    http://java.sun.com/j2se/1.4.2/docs/...abled(boolean)
    http://java.sun.com/j2se/1.4.2/docs/...ansferHandler)

    I hope it will make sense now,

Similar Threads

  1. Disable Radio button
    By AJG in forum New To Java
    Replies: 3
    Last Post: 05-10-2011, 12:09 PM
  2. How to use a drop-down box in Struts
    By piterskiy74 in forum Web Frameworks
    Replies: 1
    Last Post: 02-13-2008, 12:42 PM
  3. Drag and drop
    By abhivenugopal in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-30-2008, 03:10 PM
  4. disable parent window
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 12:15 AM
  5. Disable BACK and CANCEL buttons in wizard
    By consutes in forum SWT / JFace
    Replies: 2
    Last Post: 11-12-2007, 10:37 PM

Posting Permissions

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