Results 1 to 2 of 2
  1. #1
    gavrielk is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Question Swing drag & drop question

    Hi,

    Here is a photo of the application I'm running:

    Swing drag & drop question-battleship.jpg

    My task is to drag the ship photo/label/button from the left panel to the right one and drop it over a cell.
    My question is what classes/methods I have to use and how(extend/implement/etc..)?

    (I tried using TransferHandler("icon"), with this I didn't manage to get any information about the action so it just pops into a single cell and changes it's size.)


    Thanks in advance.
    Attached Thumbnails Attached Thumbnails Swing drag & drop question-battleship.jpg  

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default Re: Swing drag & drop question

    It's all about DnD (Drag and Drop) in Java. Basically you have to think about three levels.

    1. Drag source
    2. Data transfer
    3. Drop source

    Following document explains the all. Have a look at it and if you are stuck on anything let us know.

    Lesson: Drag and Drop and Data Transfer (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Pay your attention that, in DnD with IO process still there are some of know issues exist (I haven't check them with Java 7 and such). Worth to have a look around.

Similar Threads

  1. Need help with drag and drop
    By NixasMuraki in forum New To Java
    Replies: 2
    Last Post: 06-07-2011, 02:55 AM
  2. drag and drop
    By Dean29126 in forum New To Java
    Replies: 0
    Last Post: 01-18-2011, 08:07 AM
  3. Replies: 1
    Last Post: 03-14-2010, 11:03 PM
  4. drag and drop - disable intra component drop
    By tomba in forum AWT / Swing
    Replies: 4
    Last Post: 12-09-2009, 02:01 PM
  5. Drag and Drop
    By carderne in forum New To Java
    Replies: 0
    Last Post: 08-31-2009, 10:18 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
  •