Drag and drop question

Discussion in 'Java' started by Rhino, Apr 4, 2006.

  1. Rhino

    Rhino Guest

    I've been looking at the drag and drop tutorial at
    http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html. I want to be
    sure that I'm reading it correctly.

    Am I right in understanding that it is possible to add drag and drop support
    to _any_ JComponent or, presumably, subclass of JComponent, even if that
    component is not in the chart near the beginning of that tutorial?

    Basically, I am trying to set up a drag and drop of foreground or background
    colors from one JPanel to another. I'm also trying to ensure that it is
    possible for this transfer to be two-way. Let me explain.

    I have a simple GUI where the user needs to select 3 different colors from a
    pool of distinct colors. Each of the three selected colors is supposed to
    fill a specific role, such as a Frame color or a foreground text color. I
    want the user to select the color for each role by dragging a color from the
    pool, where each color is represented by a small square JPanel, into a
    different small JPanel that is associated with the role of the color.

    Furthermore, if the user wants to change the color associated with the role,
    I want them to put the color for that role back into the pool by dragging it
    back there, then choosing a different color of the pool. Also, if the user
    wants a color that has been selected for one role to be used for a different
    role instead, I want the user to be able to drag the color from one role's
    JPanel to the other role's JPanel. In each case, when I drag a color from
    the pool to a role, from one role to another role, or from a role back to
    the pool, I want the color to be moved, not copied. This ensures that I
    don't get two roles with the same color or have the same color in the pool
    twice.

    I'm having a bit of trouble getting the code working so I just want to make
    sure that what I'm doing is possible in the first place.

    --
    Rhino
     
    Rhino, Apr 4, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oliver Klein
    Replies:
    0
    Views:
    695
    Oliver Klein
    Aug 24, 2003
  2. mr_cross
    Replies:
    11
    Views:
    619
    dorayme
    Oct 11, 2006
  3. backstreetboy

    Drag and Drop and Generate Graphic

    backstreetboy, Oct 22, 2007, in forum: Java
    Replies:
    0
    Views:
    298
    backstreetboy
    Oct 22, 2007
  4. Wayne Vucenic

    RubyDotNet and Drag and Drop

    Wayne Vucenic, Sep 28, 2003, in forum: Ruby
    Replies:
    3
    Views:
    162
    Wayne Vucenic
    Sep 28, 2003
  5. wreed

    Drag and Drop Tree and Form Submit

    wreed, Apr 11, 2007, in forum: Javascript
    Replies:
    5
    Views:
    359
    wreed
    Apr 17, 2007
Loading...

Share This Page