Check a Dragging object when dropped ???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Check a Dragging object when dropped ???

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    4

    Post Check a Dragging object when dropped ???

    Hi,

    I'm trying to find a way to check for an object when dragged from on place
    to another.

    How can I check the item being dragged with an item it will be dropped on ?

    I tried a few things, but the only thing I get is a memory address.

    Any help/ advice ?

    Thx

  2. #2
    Join Date
    Oct 2006
    Posts
    4

    Check a Dragging object when dropped ???

    The Drop Target (a label with icon):
    Code:
            Icon icon4 = new ImageIcon("Printer");
            printerLbl = new JLabel(icon4);
    	textFieldPanel.add(printerLbl);
    	printerLbl.setBackground(new Color(255,255,10));
    	printerLbl.setForeground(new Color(255,255,10));
    	printerLbl.setOpaque(true);
    	printerLbl.setTransferHandler(new PictureTransferHandler());
    	printerLbl.setBounds(30, 172, 110, 90);
    The source (a label to be dragged):
    Code:
            peripheralLabel = new JLabel("Peripherals", icon3, JLabel.CENTER);
    	// tell it to enable the transfer of the icon
    	peripheralLabel.setTransferHandler(new PictureTransferHandler());
    	peripheralLabel.setBackground(new Color(255, 255, 10));
    	peripheralLabel.setForeground(new Color(255, 255, 10));
    	peripheralLabel.setOpaque(true);
    	peripheralLabel.setBounds(298, 19, 127, 98);
    I then have a TestButton, which will try and check if there is a match
    between the source label and the destination label, based on a name or
    text description ?

    Hope this makes things a bit clearer...
    No painkillers needed, play *FPS games...

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Does this help?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. help needed! C# object cache class..
    By djbyrne in forum .NET
    Replies: 3
    Last Post: 02-02-2007, 03:47 PM
  2. Replies: 1
    Last Post: 12-12-2006, 02:04 AM
  3. Re: Dragging an Object Between two forms
    By Phil Weber in forum .NET
    Replies: 0
    Last Post: 10-08-2001, 04:52 PM
  4. Object Modeling for the WEB
    By Greg Dirst in forum authorevents.appleman
    Replies: 1
    Last Post: 04-10-2000, 02:56 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center