How do I drag an image icon or image from one panel to another panel?

Please help.
I know to need how to drag an image icon from one panel to the other. For example, the first panel would shows the image files that is inside my folder. How can i code it so that I can drag the image that appear on the first panel into the second panel which will hold the images that I want to embed my barcode inside?
The thumbnail size of the image and showing all the image files in my folder was done already, I only need to know how can I make the image icon to be able to drag from one panel to the other.
Thanks.

I found this code in some websites:
public class ImageSelection extends TransferHandler {
     private static final DataFlavor flavors[] = {DataFlavor.imageFlavor};
     public int getSourceActions(JComponent c) {
          return TransferHandler.COPY;
     public boolean canImport(JComponent comp, DataFlavor flavor[]){
          if (!(comp instanceof JLabel)){
               return false;
          for (int i=0, n=flavor.length; i<n; i++){
               for (int j=0, m=flavors.length; j<m; j++){
                    if (flavor.equals(flavors[j])){
                         return true;
          return false;
     public Transferable createTransferable(JComponent comp) {
          if (comp instanceof JLabel) {
               JLabel label = (JLabel)comp;
               Icon icon = label.getIcon();
               if (icon instanceof ImageIcon){
                    final Image image = ((ImageIcon)icon).getImage();
                    final JLabel source = label;
                    Transferable transferable = new Transferable(){
                         public Object getTransferData(DataFlavor flavor){
                              if (isDataFlavorSupported(flavor)){
                                   return image;
                              return null;
                         public DataFlavor[] getTransferDataFlavors(){
                              return flavors;
                         public boolean isDataFlavorSupported(DataFlavor flavor){
                              return flavor.equals(DataFlavor.imageFlavor);
                    return transferable;
          return null;
     public boolean importData(JComponent comp, Transferable t){
          if (comp instanceof JLabel){
               JLabel label = (JLabel)comp;
               if (t.isDataFlavorSupported(flavors[0])){
                    try {
                         Image image = (Image)t.getTransferData(flavors[0]);
                         ImageIcon icon = new ImageIcon(image);
                         label.setIcon(icon);
                         return true;
                    catch (UnsupportedFlavorException ignored){
                    catch (IOException ignored) {
          return false;
What this codes does is to get the image from the imageicon and replace the image to the imageicon that you drag the source from. However, I had no clue how I can get the source's file name. Anyone can teach me how?
Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Upgarded to PE 13 - How do I drag an image from one screen to another (using 2 monitors)

    upgarded to PE 13 - How do I drag an image from one screen to another (using 2 monitors)

    upgarded to PE 13 - How do I drag an image from one screen to another (using 2 monitors)

  • Moving Image from one Review to Another?

    I attempted to upload an image (open in Photoshop) to a specific review. However, I could not see the desired review in the Photoshop CS Review panel. Out of frustration - after attempting to "find" the desired review for several minutes - I uploaded the image to another review and then went online, using Safari, to Acrobat.com.
    There is no visible means of moving an image from one review to another. There is a way of dragging one review (with all sub-images) to another location. But I can't see a way of moving a sub-image from one review to another review.
    IF there is some "magic" that someone knows I would sure appreciate some education.

    This works quite well for a single image review. I've moved them from one workspace to another. The issue is when a review has multiple images and you want to take only one of them from that review and move it to another review in another workspace; I can't seem to get that to work at all.
    When I open a review and navigate to the desired image, then click in the lower left corner and select a new workspace to move the image to, it moves the entire review - not the single image - to the new workspace.
    I guess I could delete the "part" from the workspace it currently exists in and then create it as a stand alone review, but then I won't be able to imbed it into another review as I want to do.
    The source frustration here is that I can't get CS Review in CSPS5 to navigate to the desired workspace/review. I get "ALL REVIEWS" displayed but not the workspaces... Any ideas on how to display workspaces instead of reviews?

  • Moving image from one project to another

    Hi all. I'm sorry if this is simple to do, but I can't figure it out. I have recently purchased Aperture 3 and am trying to figure out how to move an image from one project to another. I had several photos on my camera, and imported them this morning into it's own project. Now, I would like to take some of those photos and put them in my "family" project, and some into my "dogs" project, etc. When I open up the new project, I can't find where I can move them to another project. I have to assume this is doable, but I can't figure it out.
    Thanks in advance.
    Dale.

    Sorry to be a complete idiot, but here's my issue. When I open the original project, and then find the image that I want to move, I am unable to see any other projects (in browser view), so I have nowhere to drag them to. I hope that makes sense and you can help.
    Thanks again.
    Dale.

  • HT4878 How do i share my pictures, music and videos from one user to another on the same computer?

    How do i share my pictures, music and videos from one user to another on the same computer?

    lots of ways... you could use a thumb drive, you could drag files to the users public folder drop box, you could send it through email, you could use the internet servic called drop box (not to be confused with Apple's user public foldelr drop box).

  • How can I transfer my iTunes library and playlists from one computer to another?

    How can I transfer my iTunes library and playlists from one computer to another?

    Copy the iTunes folder (Mac: Home\Music or PC: My Music) to the same location on the new computer. If an iTunes folder already exists on the new computer (it will on a Mac) replace it with one you copied.

  • How do I copy the same app folder layouts from one device to another? We have a several iphones and ipads.

    how do I copy the same app folder layout from one device to another. We have several apple devices.
    It's a challenge when syncing a device for the first time to go through all the apps and apply them back to the same folders as on your other iphone.
    I've seen suggestions of taking pictures of the correct layout, then manually applying it to the new device. Big time waister.
    What's the work around?
    Thank you

    I'm afraid there is no short workaround. One thing that you could do if you were REALLY desperate is reset your device to factory settings and then restore it from your other device's backup, but that is rather risky and you probably don't want to take your chances just for folder layouts. I would just do it manually.

  • Copy an Image from one document to another

    Is there an easy way to copy a rectangle containing an image (not a link to an image) from one document to another?
    Thanks.
    Chris.

    I can now copy-paste text frames and linked graphics from one document to another using snippets, but embedded images still don't work.
    If I embed an image from a pdf file it works but not for jpeg images. When I open the new document (for which I placed the snippet) in InDesign, there is a frame (with a dark grey background and a diagonal cross) shown, but no contents. The place() method did not throw an exception. What am I doing wrong?
    Chris.

  • Move images from one project to another

    I have just upgraded from ap 1.5 to ap 2. In 1.5, when I moved an image from one project to another, the image was actually removed from the original project and placed in the new project. It has been my habit to upload all the images from a shoot into one project and then sort them into image specific projects; for example all blackbirds into a project labeled "blackbirds", all hawks into a project labeled hawks, etc. Once everything was sorted, the original project would be empty and I could delete it. This does not seem to be the case in ap 2. When I sort the images into their specific projects, they do disappear from the original project and thus I am unable to delete that project. Am I missing something?
    Thanks
    HPL

    I had a bit of an unusual situation. I was in fact moving images from a FOLDER to a project in another folder. Turns out that there were albums in a project in the SOURCE FOLDER. I clicked on the folder, not the project, so although moving the images did indeed remove them from the source PROJECT, they remained in the various albums in that source project, still showing up in the SOURCE FOLDER, which is what I was working from, thus the confusion. I bet I won't make that mistake again.
    Thanks for the help.
    HPL

  • How can I drag an image from a page in Safari to the finder and have it be saved as an *actual* image instead of a webloc?

    Safari used to let me drag an image from a webpage to the finder and have the dragged file be saved as an actual image but now all that's saved is a webloc file.  I want the image saved, not a reference to the image's URL - do I now have to always use "save as" to save it?
    I can understand Safari creating a webloc file if I dragged the site icon from the location bar to the finder, but to make the default behavior for dragging things that are parts of a page (not the page itself) as webloc files seems like a HUGE step backwards for usability.
    Does anyone know if there's, say, a key to hold when dragging to avoid saving a webloc file or a defaults command or something to make Safari revert back to sane draging behavior?

    Good questions...  I'll have to try and figure out when the problem first happened - I was thinking it was when I upgraded to Safari 5.1.4 but that might not be the case...  I'll try your suggestions to see if any of them eliminate the problem (I have restarted recenlty and that didn't fix it) but I'll try repairing permissions,etc.  Thanks!
    hmmm... Mcbuffy: are you implying that you *don't* get the webloc when dragging an image out of Safari and that this isn't a caused by change to Safari but is a big/conflict in mine?

  • How do I copy an image from one Keynote presentation to another one?

    I have a previously saved presentation on Keynote in iCloud. I created it from my desktop at work. Some of the images I used for the presentation I want to use again in another presentation, onlh this time I am working off my laptop and don't have the same access to those images. Is it possible to copy/paste images from one Keynote presentation into another? I can't even seem to click on the image and save it.
    Any suggestions?

    Clicking and dragging does not work.
    Click on the image and Copy and Paste
    or
    Inspector > Metrics > File Info > click on the icon of the file and drag it to your desktop
    You can then drag that file back in wherever you want.
    Peter

  • Moving images from one library to another; or how to have 2 libraries open at the same time in Aperture 2

    This may be something easy but for some reason I am having a hard time figuring this out. Basically this is the situation: I have a library on my MBP hd that I import pictures to when I am not hooked up to my external hd for the time being. The main library is of course on the external 2tb drive. How do I have 2 libraries open so that I can essentially drag and drop the pictures from one library to another? It would basically be like moving files from one project to another. Thanks for any help!

    Always keep a backup of your original images, before you delete them. I make a backup right form the card, before I even import them to Aperture.
    How are your images stored right now? Are the referenced or managed? On your big volume I'd consolidate the newly imported images, to be sure they are really inside the Aperture library before I delete any images outside the library.
    but they have the little yellow triangle caution symbol on them and I can see them but not really edit them
    That is a very typical problem, when you imported your images as referenced images then somehow delete or move the original master image files, that are stored outside the Aperture library.
    Do you still have the original masters of the images with the yellow triangle that you cannot edit? In Aperture 3 you can point Aperture to the location of the master image file "File >Locate referenced image" - probably Aperture 2 has a similar command to let you reconnect your masters, if you still have them. Look into the manual.

  • Can't MOVE images from one project to another: must not understand

    Greetings,
    I have two questions as a result of aperture not working the way that I have read on forums etc. and am wondering what i am doing wrong
    1) How do I MOVE images from project to project without duplicating masters or versions
    2) how do I delete versions
    All of my files are referenced.
    *1) moving from project to project*
    I have a blue folder called "NEFs." In it, I have a default project where I just dump all of my images called "00 dump." After I dump them, I organize into other projects. So, I do the following:
    • I create a new project called "2008 Thanksgiving" inside the NEFs blue folder making it a sibling to "00 dump"
    • I go back to "00 dump" select all the images that were shot over thanksgiving, and drag to the "2008 thanksgiving" folder. The images transfer fine, but when I go back to "00 dump" I see that the images have NOT actually moved, they are now sitting in both projects. How can this be? I thought that if I move images from project to project then I am actually moving the master, not replicating a version? That leads me to my next dilemma
    *2) how do I delete versions?*
    Now that I have replicated photos in my "2008 Thanksgiving" project, I want to delete them since I see them still sitting in "00 dump." I do the following:
    • select the "2008 Thanksgiving" project
    • select a number of images
    • press command + delete (this is the only way to delete a file as far as I can tell
    • popup comes up explaining that if I delete this file it will delete the master too and the reference file. So, that's exactly what it does.
    Deleting the referenced file is fine for many junk images, but in this case, I just want to delete the copied version that seems to be in two projects now. Any help would be greatly appreciated. I would really love a full understanding of how this structure works.
    -i

    When you drag images and the drop target is an actual little yellow project box (not a folder, and album or anything else) the images move from one project to another, if your drop target is not the actual project but something else within another project all you do is cause the version to show up there, nothing is duplicated.
    To delete a version or versions selected just use command-delete. This gets rid of the actual version not just removes it from the current album view. If it happens to be the last version of that master it will get rid of the master as well.
    Have a look at this:
    [Aperture 2 Organization|http://photo.rwboyer.com/2008/07/apple-aperture-21-organization>
    RB

  • Copying the screen image from one slide to another

    Captivate automatically switched to full motion video
    recording mode while a web page was loading in my demo. I don't
    need to show the page building, and I certainly don't want the huge
    file size required to show it, so I want to delete the video of the
    page building and replace it with a static screenshot of the web
    page. It doesn't want to let me do this seemingly simple task; when
    I select Copy Background from the static web page slide and switch
    to the live video slide, I am unable to paste the background
    in.

    > If you are wanting the same background as the previous
    slide, you would just select its name.
    That does nothing but display a preview of the slide
    background in the Preview pane.
    > Or, you could drag the image from the Library panel to
    the slide, then merge into background to set it.
    That worked. Only thing is, after I deleted the full motion
    video object from the page, the slide still has a video camera icon
    on it in the Storyboard.
    Is there any way to see the file size of a slide without
    having to use the Bandwidth Analysis window? It's great and all,
    but it takes a really long time to come up with a large
    project.

  • How can I transfer entire contents of Mail mailbox from one Mac to another?

    I've long wondered how to do this:
    I have two Macs - an iMac and a MacBook Pro.
    I have categorized several hundred emails on the MacBook into a separate "mailbox" by itself. Let's just call it "Project XYZ emails" for the sake of discussion.
    I need to transfer ALL of those emails +en masse+, hopefully still categorized together into a separate "Project XYZ emails" mailbox file, from the MacBook to the iMac. How is this done?
    In the old days, when I used to use Eudora, this was quite simple -- one could physically locate the separate desired "mailbox" file in the Finder and just copy it from one hard drive to the other, and then place the mailbox into the appropriate place of Eudora's file structure on the second computer. Relaunch Eudora and voila, the new mailbox is there for viewing, etc.
    But in Mail, I can't find any tangible "file" on my hard drive that represents a "mailbox" in the Mail program. And that includes control-clicking the application file itself and choosing "Show Package Contents." When I do that, I can see, after burrowing into the folders, a single large file called "Mail" which I think contains ALL mailboxes lumped together. But I can't see a way to separate them for individual manipulation.
    Any suggestions or ideas on how to copy entire mailboxes in Mail from one Mac to another?

    Thanks! Seems to have worked.
    Once I imported tham, I had to fiddle around renaming mailboxes and "moving" the emails to the desired locations, but that only took a minute. So overall, seems like that's the solution! I only wish that the steps to do this were made clearer by Apple in the Mail "help" menu -- where I couldn't find any mention of how to do this.
    A happy ending, in any event.
    In case anyone reads this in the future, let me add in the missing steps, to make it perfectly clear:
    In Mail, choose 'archive mailbox' from the mailbox menu.
    +Copy the newly created archived mailbox file, which will probably be a file with the suffix ".mbox," from the original machine to the second machine.+
    On the second machine: In Mail choose 'import mailbox' from the file menu.
    +The emails will now appear in a new mailbox in Mail listed under the name "imported" or "import." If desired, either rename the mailbox, or create a new mailbox with the correct name, and "move" all the emails into it.+
    Done!

Maybe you are looking for

  • How to automatically number sections in Pages 5.2?

    I'm trying to create a large, structured document with section numbering. When I apply numbered lists against the header styles, though, the numbers don't increase from section to section as each header is used, they all stay at 1, despite the fact I

  • Getting response in fault tag ?

    Hi All, My BPEL process contains an operation which has Input,Output and Fault parameters. When I initiate the process, Its completing successfully.. but my response is wrapped up in <env:Fault > Following is the response I am getting <env:Envelope x

  • My photosmart is printing pink instead of red

    When printing from photoshop my printer is printing in pink something that is clearly red. I have cleaned the printhead and there is no change 

  • Upload internal table data to Application server in Excel Sheet

    Hi All, I have all my data in an internal table.I want to Upload this data to the Application server in the EXCEL sheet with the Column Header. How can i do this.Is there any standarad function module or class to to write in xls format. Can anybody h

  • New version of firefox not compatible with my OS? what are the risks?

    Hello, When I was prompted to update my firefox browser, I was subsequently told my Macbook OS 10.5.8 didn't support the new firefox and that I would therefore be subject to cyber attacks from now on, or something similar to that. I don't actually re