Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Default Drad and drop in JPanel

    Hello everyone,

    I have a background image that is placed inside a JPanel. I would like to draw some objects over the background and to be able to drag and drop them. Currently I was able to achieve this effect by predefining the paint method of the JPanel. When I start dragging I check if the current mouse position is over an object and if so I redraw the object to the new coordinates and then draw the whole background again.

    Is there a better way to do this? For example can I drag a JLabel with an icon and transparent background inside a JPanel? In general what would be the best technique to have this done?

    Thanks!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Placing a new JPanel over a paint overriden JPanel
    By Tanshaydar in forum AWT / Swing
    Replies: 4
    Last Post: 12-08-2010, 06:00 PM
  2. Replies: 1
    Last Post: 11-09-2010, 09:28 AM
  3. Drag and Drop JPanel at Runtime
    By ravjot28 in forum AWT / Swing
    Replies: 3
    Last Post: 01-17-2010, 03:46 PM
  4. drag and drop - disable intra component drop
    By tomba in forum AWT / Swing
    Replies: 4
    Last Post: 12-09-2009, 01:01 PM
  5. Replies: 1
    Last Post: 04-01-2009, 10:28 AM

Tags for this Thread

Posting Permissions

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