Drag and drop to apply color to art.

Hi All,
I am designing a panel for Illustrator CS6 that displays colors in a datagrid as follows,
[Color] [Color_Name]
I want to be able to apply color to any art by using the drag-n-drop from the panel to the document. Is it possible that I am able to detect the art on which the color was dropped so that I can apply the color?
Thanks!

I came upon the NativeDragManager class of the CS Extension. We can use it to drag and drop objects from the panel to the application document. For this we use the ClipBoard and specify the format of the clipboard data. There are quite a few formats, namely, bitmap, text, url, file, etc. However, I couldn't use any of these so that I might drag a color from my panel to the document.
Here is a code to drag and drop a text from panel to document,
var clip:Clipboard = new Clipboard();
clip.setData(ClipboardFormats.TEXT_FORMAT, designsDG.selectedItem.Colors);
var allowedActions:NativeDragOptions = new NativeDragOptions();
NativeDragManager.doDrag(designsDG.selectedItem as InteractiveObject, clip);
Here designsDG is the datagrid containing the text.
How can I do something similar for a color object?
Any inputs?

Similar Messages

  • I can't drag and drop

    I"m running leopard i think? 10.5.7. Recently when I plugged my ipod into my computer through either the keyboard or the usb on the back and i try to drag and drop the songs from my library to my ipod i cant. it selects the song that i click when i attempt to drag and drop. this applies to both single and multiple selected songs. any idea of what to do? I don't want to do the five r's either. even though i tried all of them except the restore part, i'm trying to save that until i die because it's annoying to put more than a month of music back on my ipod.

    Select the first column before the track title.

  • Unable to drag and drop album cover art work in Itunes 10 64-bit

    I just recently installed Itunes 10 64-bit version and transfered all of my music. I wanted to add some art work to some game tracks but I can no longer drag and drop.

    Make sure your windows userid has full control and ownership over the entire music folder. Check the box to apply this to subcontainers (aka subfolders)
    This webpage has directions
    http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/P2/
    You need to restart itunes to read hte new permission settings.

  • Unable to drag and drop album art

    Hi Guys,
    I'm unable to drag and drop album artwork since upgrading to windows 7, when hovering over the "drag album art here" box it just displays a no entry cursor.
    I've tried dragging and dropping to the desktop first but this doesn't work either.
    UAC is currently disabled, my windows user is a computer administrator and has full control privileges on the Music folder.
    It's not on all my albums, just certain ones.
    I'm using iTunes 9.0.2.25

    Make sure your windows userid has full control and ownership over the entire music folder. Check the box to apply this to subcontainers (aka subfolders)
    This webpage has directions
    http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/P2/
    You need to restart itunes to read hte new permission settings.

  • Trying to drag and drop a text parameter, but it only applies to one letter

    Hiya,
    In Motion 3, you could drag and drop a Text - Style Parameter to another text object.
    Now, in Motion 4, when I try to drag a Parameter it only applies to the first letter of my text object.
    So when I drag my Glow from one object to another, my Bleary In Behavior has a blue glow on T in THIS and a yellow glow on HIS in THIS.
    I'm guessing this has to do with the ability to adjust each letter with the glyph tool. However, it won't allow me to drag the Parameter to each individual letter...
    Which I see a need for...
    But why would I want to do a time consuming thing like that?
    It's stupid.
    Any advice is much appreciated!
    Thank you

    Well, I'm not sure what to say. I can't replicate your problem. I can drag the outline parameters onto a text object in the viewer, layers pane, or timeline and it copies it exactly as it did in Motion 3, over the entire text object.
    However, if I have the glyph tool selected and try to do the same thing, it crashes Motion 100% of the time.
    Neither situation is what you're reporting though. It helped me find a bug, and something to avoid however.
    Andy

  • Drag and drop album art not working / iTunes 7.0.1.8 & WinXP SP2

    Drag and dropping album art isn't working for me after upgrading to iTunes 7 in WinXP SP2. Anyone else experience this problem?
    Update: Drag and drop works from a webpage but not from Windows explorer or Windows Picture & Fax Viewer.

    You only need an iTunes account to automatically get artwork. Usually artwork for CDs you import yourself is gotten from somewhere else. I tend to use allmusic.com. Occasionally I will have to use google to find the artwork though.
    Have never tried to add artwork from anywhere but a webpage though.

  • Drag and drop moves other art around.

    Bug? Anyone else experience placing an image into a layout via drag-and-drop and having existing imagery on the artboard get pushed around? Man CS6 really sucks.

    Thanks. D&D isn't much faster than right-clicking, copy and paste in Illy. Does that shift things? Just curious as a means of isloating. Could try placing as well just to eleminating any art hitting Illy having the effect you are describing.
    Is snap to pixel grid on? Not that it should affect the other items in Illy.
    Also, have you tried updating Illy?
    Mike

  • Firefox Drag and Drop Image to AI CS6 - displaces art on art board...

    When dragging and dropping an image from FF 20/21 into AI  CS6, it forces elements on the art board to be displaced.
    The image dragged into the app will plop into the middle of the art board, and anything in the file just gets moved.
    Where it gets moved to is inconsistent- but it appears to always move on a diagonal.
    Probably one of the weirdest things I've ever seen AI do, in 10+ years...

    It turns out that this doesn't only happen in Firefox, but the results appear (at this point) to be completely random.
    It happens in some instances in Chrome, but less frequently.
    Also, I have some examples where it is not happening at all in Firefox.
    Can't find a common thread for the problem- it's not a browser version or AI version thing, it's not a file version thing, it's not even, seemingly, the results of the objects being dragged out of the browser.

  • When i drag and drop to my ipod it wants to sync everything, but if i make changes to the syncing options and apply it wants to sync it all to make it work. i have 12000 songs and takes two days to sync everything. is there an easier way to drag and drop

    when i drag and drop to my ipod it wants to sync everything, but if i make changes to the syncing options and apply it wants to sync it all to make it work. i have 12000 songs and takes two days to sync everything. is there an easier way to drag and drop just one album without making settings changes?

    The first ever Sync of 12,000 songs to an empty iPod will take a while, but it shouldn't take two days.
    Once all 12,000 songs have been Synced to the iPod, subsequent changes to just one album will result in a very short Sync time. That Sync will include:
    the change to that one album
    play counts on iPod updated into your iTunes Library
    Smart Playlists updated: some complex Smart Playlists are not always updated by the iPod but have to wait for a Sync with the Library.
    housework - in other words, behind the scenes tasks that we don't need to see.
    Those subsequent Syncs do not sync every single song every time.
    So, stick with Syncing. If the first Sync of all your songs is taking too long, try syncing part of the Library (say one or two genres) the first time, a further part the second time and so on. After all, with a Library that large, manually managing the iPod will be a source of torture.

  • NamedViewCriteria not working when drag and dropped as filtered table.

    Using JDev 11.1.2.1.0.
    I'm attempting to use NamedViewCriteria more and more because, well ... I keep reading it's the way to go. But I'm encountering an aggravating problem. I can't get them to work when I drag and drop as a filtered table onto a page. They work when I apply them in a managed bean, but simply dragging and dropping will not trigger the NamedViewCriteria to display the filtered items correctly.
    Creating a where clause manually works fine.
    Manual Where Clause & drag and drop ViewObject from data control
    (:pBpKey is null or upper(BP_KEY) like '%' || upper(:pBpKey) || '%') AND CinderBusinessPartners.BP_TYPE = 'C'NamedViewCriteria & drag and drop from ViewObject's NamedViewCriteria from data control
    ( ( (CinderBusinessPartners.BP_KEY LIKE ('%' || :pBpKey || '%') ) AND (CinderBusinessPartners.BP_TYPE = 'C' ) ) )There are three problems:
    1) The query pulls back all items. It doesn't retrieve only where BP_TYPE = 'C'.
    2) It is case sensitive. i.e. Enter in A will not pull back the customer Wal-Mart because Wal-mart contains lowercase a's.
    3) If I set the table's "Show Filter" attribute to true, the filter has the text "\*pBpKey\*" filled in by default. uhhh What?
    In the NamedViewCriteria's "UI Hints" tab, I have the "Query Automatically" checkbox selected.
    Any ideas why the NamedViewCriteria isn't "just working"?
    I'll be back with pictures after the break.
    Will

    I've rolled this into a bug post as seen here: BUG: NamedViewCriteria drag and drop as table SNAFU
    Pictures:
    Here is the NVC query
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc1.jpg
    Here's that dang extra bind variable!
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc3.jpg
    And just because I like awesome Paint.Net art.
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc2.jpg
    Hope this helps someone down the road.
    Edited by: LovettWB on Apr 26, 2012 1:59 PM

  • Drag and Drop an image

    Can anyone recommend me a good tutorial on how to drag and drop or even resize an image in a panel ?

    I'm back.
    I wrote a 2 classes appli that allow to move and resize images displayed in a panel.
    The first class is the most interesting one. It describes an object which extends Rectangle and manage an Image. This class names TransformableImage extends Rectangle because we need to know the bounds of the rectangle, where the image is contained in, to allow mouse interactions through the panel.
    The behavior we want is to change the kind of cursors according to the position of the mouse on the panel :
    if the mouse is out of any images the cursor is the default one. If the cursor is on an image, it can be a move cursor in the center of the image or one of the resize cursors if the mouse is on the border of the image.
    Here is the class :
    import java.awt.*;
    import javax.swing.*;
    import java.awt.image.*;
    public final class TransformableImage extends Rectangle {
         public static final int MOVE = 0;
         public static final int RESIZE_TOP = 10;
         public static final int RESIZE_BOTTOM = 20;
         public static final int RESIZE_RIGHT = 1;
         public static final int RESIZE_LEFT = 2;
         public static final int RESIZE_TOP_RIGHT_CORNER = 11;
         public static final int RESIZE_TOP_LEFT_CORNER = 12;
         public static final int RESIZE_BOTTOM_RIGHT_CORNER = 21;
         public static final int RESIZE_BOTTOM_LEFT_CORNER = 22;
         public static final int BORDER_THICKNESS = 5;
         public static final int MIN_THICKNESS = BORDER_THICKNESS*2;
         private static final Color borderColor = Color.black;
         private Image image;
         * Create an TransformableImage from the image file filename.
         * The TransformableImage bounds (inherited from the class Rectangle) are setted to the corresponding values.
         public TransformableImage(String filename) {
              ImageIcon ic = new ImageIcon(filename);
              image = ic.getImage();
              setBounds(0,0,ic.getIconWidth(), ic.getIconHeight());
         * Draw the image rescaled to fit the bounds.
         * A black rectangle is drawn around the image.
         public final void draw(Graphics2D g, ImageObserver observer) {
              Color oldColor = g.getColor();
              g.setColor(borderColor);
              g.drawImage(image, x, y, width, height, observer);
              g.draw(this);
              g.setColor(oldColor);
         * Return an int corresponding to the transformation available according to the mouse location on the image.
         * If the point p is in the border, with a thickness of BORDER_THICKNESS, around the image, the corresponding
         * transformation is returned (RESIZE_TOP, ..., RESIZE_BOTTOM_LEFT_CORNER).
         * If the point p is located in the center of the image (i.e. out of the border), the MOVE transformation is returned.
         * We allways suppose that p is contained in the image bounds.
         public final int getTransformation(Point p) {
              int px = p.x;
              int py = p.y;
              int transformation = 0;
              if (py<(y+BORDER_THICKNESS)) {
                   transformation += RESIZE_TOP;
              else
              if (py>(y+height-BORDER_THICKNESS-1)) {
                   transformation += RESIZE_BOTTOM;
              if (px<(x+BORDER_THICKNESS)) {
                   transformation += RESIZE_LEFT;
              else
              if (px>(x+width-BORDER_THICKNESS-1)) {
                   transformation += RESIZE_RIGHT;
              return(transformation);
         * Move the left side of the image, verifying that the width is > to the MIN_THICKNESS.
         public final void moveX1(int px) {
              int x1 = x+width;
              if (px>x1-MIN_THICKNESS) {
                   x = x1-MIN_THICKNESS;
                   width = MIN_THICKNESS;
              else {
                   width += (x-px);
                   x = px;               
         * Move the right side of the image, verifying that the width is > to the MIN_THICKNESS.
         public final void moveX2(int px) {
              width = px-x;
              if (width<MIN_THICKNESS) {
                   width = MIN_THICKNESS;
         * Move the top side of the image, verifying that the height is > to the MIN_THICKNESS.
         public final void moveY1(int py) {
              int y1 = y+height;
              if (py>y1-MIN_THICKNESS) {
                   y = y1-MIN_THICKNESS;
                   height = MIN_THICKNESS;
              else {
                   height += (y-py);
                   y = py;               
         * Move the bottom side of the image, verifying that the height is > to the MIN_THICKNESS.
         public final void moveY2(int py) {
              height = py-y;
              if (height<MIN_THICKNESS) {
                   height = MIN_THICKNESS;
         * Apply a given transformation with the given Point to the image.
         * The shift values dx and dy are needed for move tho locate the image at the same relative position from the cursor (p).
         public final void transform(Point p, int transformationType, int dx, int dy) {
              int px = p.x;
              int py = p.y;
              switch (transformationType) {
                   case MOVE : x = px-dx; y = py-dy;
                        break;
                   case RESIZE_TOP : moveY1(py);
                        break;
                   case RESIZE_BOTTOM : moveY2(py);
                        break;
                   case RESIZE_LEFT : moveX1(px);
                        break;
                   case RESIZE_RIGHT : moveX2(px);
                        break;
                   case RESIZE_TOP_LEFT_CORNER : moveX1(px);moveY1(py);
                        break;
                   case RESIZE_TOP_RIGHT_CORNER : moveX2(px);moveY1(py);
                        break;
                   case RESIZE_BOTTOM_LEFT_CORNER : moveX1(px);moveY2(py);
                        break;
                   case RESIZE_BOTTOM_RIGHT_CORNER : moveX2(px);moveY2(py);
                        break;
                   default :
    }And now, we need to create the panel where we are going to draw the images and interact with them with the mouse. In fact we need a paintComponent method used to draw the images and a Mouse(Motion)Listener to manage the required mouse events.
    We also have to create a method to set the convenient cursor according to tha position of the mouse over the images.
    Here is the class :
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class ImagePanel extends JComponent {
         private static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR);
         private static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR);
         private static final Cursor VERTICAL_RESIZE_CURSOR = new Cursor(Cursor.N_RESIZE_CURSOR);
         private static final Cursor HORIZONTAL_RESIZE_CURSOR = new Cursor(Cursor.W_RESIZE_CURSOR);
         private static final Cursor NW_SE_RESIZE_CURSOR = new Cursor(Cursor.NW_RESIZE_CURSOR);
         private static final Cursor NE_SW_RESIZE_CURSOR = new Cursor(Cursor.NE_RESIZE_CURSOR);
         public Vector images;
         * Create an ImagePanel with two images in.
         * A MouseHandler instance is added as mouse listener and mouse motion listener.
         public ImagePanel() {
              images = new Vector();
              images.add(new TransformableImage("image1.gif"));
              images.add(new TransformableImage("image2.gif"));
              setPreferredSize(new Dimension(600,600));
              MouseHandler mh = new MouseHandler();
              addMouseListener(mh);
              addMouseMotionListener(mh);
         * Simply paint all the images contained in the Vector images, calling their method draw(Graphics2D, ImageObserver).
         public void paintComponent(Graphics g) {
              Graphics2D g2D = (Graphics2D)g;
              for (int i = images.size()-1; i>=0; i--) {     
                   ((TransformableImage)images.get(i)).draw(g2D, this);
         * Inner class defining the behavior of the mouse.
         final class MouseHandler extends MouseInputAdapter {
              private TransformableImage draggedImage;
              private int transformation;
              private int dx, dy;
              public void mouseMoved(MouseEvent e) {
                   Point p = e.getPoint();
                   TransformableImage image = getImageAt(p);
                   if (image != null) {
                        transformation = image.getTransformation(p);
                        setConvenientCursor(transformation);
                   else {
                        setConvenientCursor(-1);
              public void mousePressed(MouseEvent e) {
                   Point p = e.getPoint();
                   draggedImage = getImageAt(p);
                   if (draggedImage!=null) {
                        dx = p.x-draggedImage.x;
                        dy = p.y-draggedImage.y;
              public void mouseDragged(MouseEvent e) {
                   if (draggedImage==null) {
                        return;
                   Point p = e.getPoint();
                   repaint(draggedImage.x,draggedImage.y,draggedImage.width+1,draggedImage.height+1);
                   draggedImage.transform(p, transformation,dx,dy);
                   repaint(draggedImage.x,draggedImage.y,draggedImage.width+1,draggedImage.height+1);
              public void mouseReleased(MouseEvent e) {
                   Point p = e.getPoint();
                   draggedImage = null;
         * Utility method used to get the image located at a Point p.
         * Returns null if there is no image at this point.
         private final TransformableImage getImageAt(Point p) {
              TransformableImage image = null;
              for (int i = 0, n = images.size(); i<n; i++) {     
                   image = (TransformableImage)images.get(i);
                   if (image.contains(p)) {
                        return(image);
              return(null);
         * Sets the convenient cursor according the the transformation (i.e. the position of the mouse over the image).
         private final void setConvenientCursor(int transfo) {
              Cursor currentCursor = getCursor();
              Cursor newCursor = null;
              switch (transfo) {
                   case TransformableImage.MOVE : newCursor = MOVE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP : newCursor = VERTICAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM : newCursor = VERTICAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_LEFT : newCursor = HORIZONTAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_RIGHT : newCursor = HORIZONTAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP_LEFT_CORNER : newCursor = NW_SE_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP_RIGHT_CORNER : newCursor = NE_SW_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM_LEFT_CORNER : newCursor = NE_SW_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM_RIGHT_CORNER : newCursor = NW_SE_RESIZE_CURSOR;
                        break;
                   default : newCursor = DEFAULT_CURSOR;
              if (newCursor != null && currentCursor != newCursor) {
                   setCursor(newCursor);
         public static void main(String[] args) {
              JFrame frame = new JFrame("Test transformable images");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new ImagePanel(), BorderLayout.CENTER);
              frame.pack();
              frame.setVisible(true);
    }If you want more information tell me.
    ------- Here is the unformatted version -----
    import java.awt.*;
    import javax.swing.*;
    import java.awt.image.*;
    public final class TransformableImage extends Rectangle {
         public static final int MOVE = 0;
         public static final int RESIZE_TOP = 10;
         public static final int RESIZE_BOTTOM = 20;
         public static final int RESIZE_RIGHT = 1;
         public static final int RESIZE_LEFT = 2;
         public static final int RESIZE_TOP_RIGHT_CORNER = 11;
         public static final int RESIZE_TOP_LEFT_CORNER = 12;
         public static final int RESIZE_BOTTOM_RIGHT_CORNER = 21;
         public static final int RESIZE_BOTTOM_LEFT_CORNER = 22;
         public static final int BORDER_THICKNESS = 5;
         public static final int MIN_THICKNESS = BORDER_THICKNESS*2;
         private static final Color borderColor = Color.black;
         private Image image;
         * Create an TransformableImage from the image file filename.
         * The TransformableImage bounds (inherited from the class Rectangle) are setted to the corresponding values.
         public TransformableImage(String filename) {
              ImageIcon ic = new ImageIcon(filename);
              image = ic.getImage();
              setBounds(0,0,ic.getIconWidth(), ic.getIconHeight());
         * Draw the image rescaled to fit the bounds.
         * A black rectangle is drawn around the image.
         public final void draw(Graphics2D g, ImageObserver observer) {
              Color oldColor = g.getColor();
              g.setColor(borderColor);
              g.drawImage(image, x, y, width, height, observer);
              g.draw(this);
              g.setColor(oldColor);
         * Return an int corresponding to the transformation available according to the mouse location on the image.
         * If the point p is in the border, with a thickness of BORDER_THICKNESS, around the image, the corresponding
         * transformation is returned (RESIZE_TOP, ..., RESIZE_BOTTOM_LEFT_CORNER).
         * If the point p is located in the center of the image (i.e. out of the border), the MOVE transformation is returned.
         * We allways suppose that p is contained in the image bounds.
         public final int getTransformation(Point p) {
              int px = p.x;
              int py = p.y;
              int transformation = 0;
              if (py<(y+BORDER_THICKNESS)) {
                   transformation += RESIZE_TOP;
              else
              if (py>(y+height-BORDER_THICKNESS-1)) {
                   transformation += RESIZE_BOTTOM;
              if (px<(x+BORDER_THICKNESS)) {
                   transformation += RESIZE_LEFT;
              else
              if (px>(x+width-BORDER_THICKNESS-1)) {
                   transformation += RESIZE_RIGHT;
              return(transformation);
         * Move the left side of the image, verifying that the width is > to the MIN_THICKNESS.
         public final void moveX1(int px) {
              int x1 = x+width;
              if (px>x1-MIN_THICKNESS) {
                   x = x1-MIN_THICKNESS;
                   width = MIN_THICKNESS;
              else {
                   width += (x-px);
                   x = px;               
         * Move the right side of the image, verifying that the width is > to the MIN_THICKNESS.
         public final void moveX2(int px) {
              width = px-x;
              if (width<MIN_THICKNESS) {
                   width = MIN_THICKNESS;
         * Move the top side of the image, verifying that the height is > to the MIN_THICKNESS.
         public final void moveY1(int py) {
              int y1 = y+height;
              if (py>y1-MIN_THICKNESS) {
                   y = y1-MIN_THICKNESS;
                   height = MIN_THICKNESS;
              else {
                   height += (y-py);
                   y = py;               
         * Move the bottom side of the image, verifying that the height is > to the MIN_THICKNESS.
         public final void moveY2(int py) {
              height = py-y;
              if (height<MIN_THICKNESS) {
                   height = MIN_THICKNESS;
         * Apply a given transformation with the given Point to the image.
         * The shift values dx and dy are needed for move tho locate the image at the same relative position from the cursor (p).
         public final void transform(Point p, int transformationType, int dx, int dy) {
              int px = p.x;
              int py = p.y;
              switch (transformationType) {
                   case MOVE : x = px-dx; y = py-dy;
                        break;
                   case RESIZE_TOP : moveY1(py);
                        break;
                   case RESIZE_BOTTOM : moveY2(py);
                        break;
                   case RESIZE_LEFT : moveX1(px);
                        break;
                   case RESIZE_RIGHT : moveX2(px);
                        break;
                   case RESIZE_TOP_LEFT_CORNER : moveX1(px);moveY1(py);
                        break;
                   case RESIZE_TOP_RIGHT_CORNER : moveX2(px);moveY1(py);
                        break;
                   case RESIZE_BOTTOM_LEFT_CORNER : moveX1(px);moveY2(py);
                        break;
                   case RESIZE_BOTTOM_RIGHT_CORNER : moveX2(px);moveY2(py);
                        break;
                   default :
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class ImagePanel extends JComponent {
         private static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR);
         private static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR);
         private static final Cursor VERTICAL_RESIZE_CURSOR = new Cursor(Cursor.N_RESIZE_CURSOR);
         private static final Cursor HORIZONTAL_RESIZE_CURSOR = new Cursor(Cursor.W_RESIZE_CURSOR);
         private static final Cursor NW_SE_RESIZE_CURSOR = new Cursor(Cursor.NW_RESIZE_CURSOR);
         private static final Cursor NE_SW_RESIZE_CURSOR = new Cursor(Cursor.NE_RESIZE_CURSOR);
         public Vector images;
         * Create an ImagePanel with two images in.
         * A MouseHandler instance is added as mouse listener and mouse motion listener.
         public ImagePanel() {
              images = new Vector();
              images.add(new TransformableImage("image1.gif"));
              images.add(new TransformableImage("image2.gif"));
              setPreferredSize(new Dimension(600,600));
              MouseHandler mh = new MouseHandler();
              addMouseListener(mh);
              addMouseMotionListener(mh);
         * Simply paint all the images contained in the Vector images, calling their method draw(Graphics2D, ImageObserver).
         public void paintComponent(Graphics g) {
              Graphics2D g2D = (Graphics2D)g;
              for (int i = images.size()-1; i>=0; i--) {     
                   ((TransformableImage)images.get(i)).draw(g2D, this);
         * Inner class defining the behavior of the mouse.
         final class MouseHandler extends MouseInputAdapter {
              private TransformableImage draggedImage;
              private int transformation;
              private int dx, dy;
              public void mouseMoved(MouseEvent e) {
                   Point p = e.getPoint();
                   TransformableImage image = getImageAt(p);
                   if (image != null) {
                        transformation = image.getTransformation(p);
                        setConvenientCursor(transformation);
                   else {
                        setConvenientCursor(-1);
              public void mousePressed(MouseEvent e) {
                   Point p = e.getPoint();
                   draggedImage = getImageAt(p);
                   if (draggedImage!=null) {
                        dx = p.x-draggedImage.x;
                        dy = p.y-draggedImage.y;
              public void mouseDragged(MouseEvent e) {
                   if (draggedImage==null) {
                        return;
                   Point p = e.getPoint();
                   repaint(draggedImage.x,draggedImage.y,draggedImage.width+1,draggedImage.height+1);
                   draggedImage.transform(p, transformation,dx,dy);
                   repaint(draggedImage.x,draggedImage.y,draggedImage.width+1,draggedImage.height+1);
              public void mouseReleased(MouseEvent e) {
                   Point p = e.getPoint();
                   draggedImage = null;
         * Utility method used to get the image located at a Point p.
         * Returns null if there is no image at this point.
         private final TransformableImage getImageAt(Point p) {
              TransformableImage image = null;
              for (int i = 0, n = images.size(); i<n; i++) {     
                   image = (TransformableImage)images.get(i);
                   if (image.contains(p)) {
                        return(image);
              return(null);
         * Sets the convenient cursor according the the transformation (i.e. the position of the mouse over the image).
         private final void setConvenientCursor(int transfo) {
              Cursor currentCursor = getCursor();
              Cursor newCursor = null;
              switch (transfo) {
                   case TransformableImage.MOVE : newCursor = MOVE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP : newCursor = VERTICAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM : newCursor = VERTICAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_LEFT : newCursor = HORIZONTAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_RIGHT : newCursor = HORIZONTAL_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP_LEFT_CORNER : newCursor = NW_SE_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_TOP_RIGHT_CORNER : newCursor = NE_SW_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM_LEFT_CORNER : newCursor = NE_SW_RESIZE_CURSOR;
                        break;
                   case TransformableImage.RESIZE_BOTTOM_RIGHT_CORNER : newCursor = NW_SE_RESIZE_CURSOR;
                        break;
                   default : newCursor = DEFAULT_CURSOR;
              if (newCursor != null && currentCursor != newCursor) {
                   setCursor(newCursor);
         public static void main(String[] args) {
              JFrame frame = new JFrame("Test transformable images");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new ImagePanel(), BorderLayout.CENTER);
              frame.pack();
              frame.setVisible(true);
    Denis

  • Text Wont Show And I cant drag and drop

    ok well when I insert text it doesnt show but It shows what i written on the side. I have contact support their answer was they can't help me because I am trial verison. I am simply not going to buy a program if the trial verison is not working its that simple. Also When I try to drag and drop a picture a little circle apears with the line through it. I do have admin rights.

    Usually when you can not see text is is one of the following.
    1)Color of the text is the same color as the background
    2)there is a layer over top of the text blocking the text
    3)The opacity of the text layer is almost transparent (the opacity is less than 100%)
    4)A blend mode is applied to the text layer
    5)A layer style is applied to the text layer that either does 1, 2, or 4
    As far as draging and dropping, just drag the file from your respective file viewer and drop it on the background of photoshop (it will open the file assuming it is a file that photoshop can read)
    So verify that the file can be viewed in another app to make sure the file is not corrupt
    Make sure the file extention is one that photoshop supports. (in photoshop go to the menu and select File>Open, then find the text that says file type and click on the box next to it. That will drop down a list of supported file types. If it is not listed, it will not open)
    That being said there are time when it should work and don't, so if anything here does not work, post back and someone can help.
    By the way, it best to post what version of photoshop you have, what operating system you have and a screen grab of photoshop so we can see what you see. For future reference...

  • Problem with drag and drop on Mac

    Hi, when I run my AIR application on Windows, I'm able to do
    the drag and drop.
    But when I run the application on Mac, it gave me an
    allocation error: unable to allocate region of size <random
    number> after I drag and drop thrice.
    Anybody knows what's the reason?

    Pages does not support the Apple font used for color emoji, so that behavior is normal.
    With what app are you reading the yahoo mail?  There is really no guarantee than any other email service will show the special Apple font involved.
    You should have no problem putting emoji directly into Mail or Text edit via drag drop from the Character Viewer as shown below.
    You should also be able to upload graphics here easily by clicking on the camera icon.  My email is tom at bluesky dot org.

  • I can't drag and drop songs onto my iPod from iTunes. (Manual transfer is not working.)  Please help!

    Normally, I just select songs and I'm able to drag and drop them from my library onto my device.  I have an iPod Touch and an iPhone 4.  I want to drag and drop my songs from the library onto my iPod Touch.  I have already selected manual upload instead of automatic sync.  I tried suggestions from the Mac message board (since other people seem to have had a similar issue), and their solutions didn't work for me.  I have restarted both iTunes, my computer, and reconnected my iPod multiple times.  I don't know what's going on, and I can't find a fix anywhere in iTunes help.  If anyone knows what to do, or has any suggestions, please let me know!  Thanks.

    Update: I seem to have fixed the problem!  I went to the "summary" section of my iPod after clicking on the device on the left side of iTunes.  I checked the box that allowed me to "manually manage music and videos" and applied this option.  The songs are syncing!  And, yay, they're playing on my iPod now!  Hopefully, this helps anyone else who might have this problem.  There might be other issues, but this is working for now.

  • How to drag and drop a file with its Systemfile icon to a Jtext area

    I want to drag and drop a file to a JText area with its system file icon , but the problem is I cant show the file icon.
    Anyone knows this.
    this is my code.
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.dnd.DnDConstants;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import javax.swing.*;
    import javax.swing.filechooser.FileSystemView;
    public class FileDrag extends JFrame implements DropTargetListener {
    DropTarget dt;
    File file;
    JTextArea ta;
    JLabel lbl;
    Graphics g;
    ImageIcon tmpIcon;
    public FileDrag() {
    super("Drop Test");
    setSize(300, 300);
    getContentPane().add(
    new JLabel("Drop a list from your file chooser here:"),
    BorderLayout.NORTH);
    ta = new JTextArea();
    ta.setBackground(Color.white);
    getContentPane().add(ta);
    dt = new DropTarget(ta, this);
    setVisible(true);
    public void dragEnter(DropTargetDragEvent dtde) {
    System.out.println("Drag Enter");
    public void dragExit(DropTargetEvent dte) {
    System.out.println("Source: " + dte.getSource());
    System.out.println("Drag Exit");
    public void dragOver(DropTargetDragEvent dtde) {
    System.out.println("Drag Over");
    public void dropActionChanged(DropTargetDragEvent dtde) {
    System.out.println("Drop Action Changed");
    public void drop(DropTargetDropEvent dtde) {
    FileSystemView view = FileSystemView.getFileSystemView();
    JLabel testb;
    Icon icon = null;
    Toolkit tk;
    Dimension dim;
    BufferedImage buff = null;
    try {
    Transferable tr = dtde.getTransferable();
    DataFlavor[] flavors = tr.getTransferDataFlavors();
    for (int i = 0; i < flavors.length; i++) {
    System.out.println("Possible flavor: " + flavors.getMimeType());
    if (flavors[i].isFlavorJavaFileListType()) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    ta.setText("Successful file list drop.\n\n");
    java.util.List list = (java.util.List) tr.getTransferData(flavors[i]);
    for (int j = 0; j < list.size(); j++) {
    System.out.println(list.get(j));
    file = (File) list.get(j);
    icon = view.getSystemIcon(file);
    ta.append(list.get(j) + "\n");
    ta.append("\n");
    tk = Toolkit.getDefaultToolkit();
    dim = tk.getBestCursorSize(icon.getIconWidth(), icon.getIconHeight());
    buff = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
    icon.paintIcon(ta, buff.getGraphics(), 10, 10);
    repaint();
    dtde.dropComplete(true);
    return;
    System.out.println("Drop failed: " + dtde);
    dtde.rejectDrop();
    } catch (Exception e) {
    e.printStackTrace();
    dtde.rejectDrop();
    public static void main(String args[]) {
    new FileDrag();

    I want to drag and drop a file to a JText area with its system file icon , but the problem is I cant show the file icon.
    Anyone knows this.
    this is my code.
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.dnd.DnDConstants;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import javax.swing.*;
    import javax.swing.filechooser.FileSystemView;
    public class FileDrag extends JFrame implements DropTargetListener {
    DropTarget dt;
    File file;
    JTextArea ta;
    JLabel lbl;
    Graphics g;
    ImageIcon tmpIcon;
    public FileDrag() {
    super("Drop Test");
    setSize(300, 300);
    getContentPane().add(
    new JLabel("Drop a list from your file chooser here:"),
    BorderLayout.NORTH);
    ta = new JTextArea();
    ta.setBackground(Color.white);
    getContentPane().add(ta);
    dt = new DropTarget(ta, this);
    setVisible(true);
    public void dragEnter(DropTargetDragEvent dtde) {
    System.out.println("Drag Enter");
    public void dragExit(DropTargetEvent dte) {
    System.out.println("Source: " + dte.getSource());
    System.out.println("Drag Exit");
    public void dragOver(DropTargetDragEvent dtde) {
    System.out.println("Drag Over");
    public void dropActionChanged(DropTargetDragEvent dtde) {
    System.out.println("Drop Action Changed");
    public void drop(DropTargetDropEvent dtde) {
    FileSystemView view = FileSystemView.getFileSystemView();
    JLabel testb;
    Icon icon = null;
    Toolkit tk;
    Dimension dim;
    BufferedImage buff = null;
    try {
    Transferable tr = dtde.getTransferable();
    DataFlavor[] flavors = tr.getTransferDataFlavors();
    for (int i = 0; i < flavors.length; i++) {
    System.out.println("Possible flavor: " + flavors.getMimeType());
    if (flavors[i].isFlavorJavaFileListType()) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    ta.setText("Successful file list drop.\n\n");
    java.util.List list = (java.util.List) tr.getTransferData(flavors[i]);
    for (int j = 0; j < list.size(); j++) {
    System.out.println(list.get(j));
    file = (File) list.get(j);
    icon = view.getSystemIcon(file);
    ta.append(list.get(j) + "\n");
    ta.append("\n");
    tk = Toolkit.getDefaultToolkit();
    dim = tk.getBestCursorSize(icon.getIconWidth(), icon.getIconHeight());
    buff = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
    icon.paintIcon(ta, buff.getGraphics(), 10, 10);
    repaint();
    dtde.dropComplete(true);
    return;
    System.out.println("Drop failed: " + dtde);
    dtde.rejectDrop();
    } catch (Exception e) {
    e.printStackTrace();
    dtde.rejectDrop();
    public static void main(String args[]) {
    new FileDrag();

Maybe you are looking for