Preventing drag and drop

I've been working very hard to keep my play lists organized and every so often I'll accidentally drag and drop one play list into another. Is there a way to stop this from happening? I like the power to be able to drag groups of songs and such but I don't want to be able to just click on a play list's name and drag and drop it into another one. Any suggestions would be appreciated.

There is no way to prevent it, and no "Undo" if you do it accidentally. Sorry.
As an experiment, go to your Settings in Control Panel and try a lower pixel count. This may make the display and associated mouse operations a bit less error-prone.

Similar Messages

  • Running application from installer in vista prevents drag and drop

    Running a desktop application from Vista and Windows 7 through a wizzard, prevents doing a drag and drop from the desktop or another windows explorer to our java application.
    We are using a windows wizard to install the application once it finishes it launches the application within the application the drag and drop work perfectly, but I can not drag from desktop or external windows explorer into my application, dragging from the application to the desktop or to another windows explorer is working fine.
    If we run the application by clicking directly on the exe file (generated by the installer app), the application launches and do not present the anomaly (Drag and drop into a out side the applications work fine).
    So the issue might be related to the way the installer executes the application, that maybe have a different configuration or windows permissions are not set correctly when started by the installer.
    Both ways of launching the application have the same working directory the only difference i found was in the system environment (System.getenv()) the one that works has a SESSIONNAME key with a CONSOLE value in it, could this be the problem?
    Any idea on how to workaround this issue or some idea to look at the installer will be kindly appreciated.

    One idea is to use [Java Webstart|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp] *(<- link)* as your installer. It might not fix the D'n'D problem, but at least if you get to the point of telling Sun about it, they will care (at least) one iota about fixing it.

  • Prevent drag and drop for QT web movies

    I've tried protecting QT movies on my web site using kioskmode, like this:
    http://www.apple.com/quicktime/tutorials/embed2.html#kioskmode
    but despite what Apple says, drag and drop remains enabled. Anyone know how to fix that?
    conran

    If your goal is to "protect" your videos the kioskmode="true" tag will be the weakest link.
    http://streamingmediaworld.com/gen/voices/praja/praja1.mov
    You can open and save the file using the Safari (or any other browser) by using the Safari Activity window.
    You can also download by dragging the link to the Download window.
    I use the Save As Un-Editalbe droplet on some of my files. Needs some work to run on a Tiger OS and you can email me for a copy that is Tiger "ready". Screen name (left) @ mac.com.
    But I still don't understand how drag and drop works if the file is "protected" via kioskmode="false" tags.

  • Drag and Drop of cell content between 2 tables

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can I prevent Visio 2010 from allowing drag and drop of swimlanes?

    I am having a pesky issue while putting together my cross functional flow charts that I would like to prevent.  When I accidentally click and drag a swimlane, it moves.  Is there a way to change a flowchart property where it will not allow a user
    to drag and drop columns?  We have multiple people editing the same flowchart and sometimes people accidentally mess it up by dragging and dropping a swimlane instead of the boxes inside the swimlane.  
    Thank you for your help!  I can't seem to find a setting anywhere that disables drag and drop of swimlanes.

    First, ensure you have the Developer tab enabled. Now select a swimlane, then Developer -> Protection
    and check X Position and Y Position.
    Paul Herber, Sandrila Ltd. Engineering and software shapes for Visio
    Sandrila Ltd

  • Mail "New Message" window retreats to background after drag and drop attachment from Finder to Mail "New Message", click, and Finder window stays in foreground even when not in focus

    Hi, I'm surprised I can't quickly find if anyone else is having this issue. For me it has been going on since Lion on my 13" MacBook Pro 2011 and it's still persisting in Mavericks, and even still now that I've "downgraded" to a 15" MacBook Pro 2010 with Mavericks.  The behavior is odd and difficult to explain concisely. Basically, when I want to add an attachment to Mail, I'll Cmd+Tab over to Finder click and drag and Cmd+Tab back to Mail, and drop the attachment. At first it looks fine, but when I click in the New Message window where I just dropped the attachment, to move the cursor, it retreats to the background and the Mail Main Window comes to the foreground. Then, if I click on that, the Finder window that I just used comes to the foreground. Sometimes if I switched to another app before going to Finder to select the drag and drop, that other app window will appear in the foreground instead. If I click on the other app window that is now in the foreground, then the Finder window that was last used will come to the foreground. The only thing that seems to fix this switch-a-roo effect is Cmd+Tab-ing back and forth a few times, or click on the window "frame" at the top to move the window around.
    The way to prevent this is to have my Mail Message window visible in the foreground side by side with the Finder window when the drag and drop occurs (this is a tedious extra step if mulitple windows are open, or to use the add attachment command in the menu within Mail. But it sure is annoying buggy behavior.
    Thanks
    Daniel

    Yep, I get exactly the same thing when using Thunderbird mail client on my 2011 iMac running Lion. I've been putting up with it for at least a year, maybe longer.
    For me it appeared to start after a Thunderbird update, so I figured that was the cause and couldn't find a solution at the time. However I've now noticed it starting to happen in Apple Motion 4 when dragging files from Finder into a DropZone in my animations. Motion remains the active program but the Finder window sits on top until I Cmd-tab out to a third open program (ie not Finder) and back to Motion again.
    This is the first indicator I've had that it's an OS X issue.
    Be great to find a solution as D&D is by far my preferred way of adding attachments to emails and similar tasks.

  • Why does the drag and drop context menu always popup when dragging files between windows explorer instances ?

    I have fusion 7.1.1 on an iMac 27 inch retina. 32GB ram of which 6GB assigned to Fusion and 2 cores. Windows 7 Home Premium installed. Mostly working fine but a few funnies. First and foremost: Whenever I drag and drop between instances of windows explorer, I get the little pop-up context menu offering me Copy Here / Move Here etc.  etc. I have never known Windows to ask me what I want to do when I drag stuff - why is this happening ? I have scoured the net for info on this and found nothing. Please note that this is NOT associated with the Start Menu (For which I found a zillion solutions to whatever that problem is). Also, It is NOT to do with stopping drag & drop and Context menus: yes, I know how to do that but that is NOT what I'm asking to get rid of. This may not be related but I have also had to set my Internet Properties / Explorer settings / Launching-applications-and-unsafe-files to "Enable" to prevent every shortcut I create causing a "Do you want to run this ... ?" message every time I click on them. Doing this has caused WIndows 7 to turn into a finger-wagging safety-nanny glaring at me over its demi-lune spectacles.

    Ok ... fixed
    Here is the way http://forums.creativecow.net/thread/3/944828
    In your sequence, on the left most column you should see a V1 (left of the Lock Track button). Click that to make sure its highlighted, it allows you to drop video to the sequence.

  • Drag and drop functionality in CM25

    Hello Experts,
         I am trying to configure CM25 so that when you drag and drop to change the start and end times on an operation within a process order, but to block the work centre being changed.  Ideally I like the user to be prompted to ensure they intended to change the work centre, but could live with a hard stop.  I have drag drop function set to AV09 (Function "Operation at time&work centre") at the moment.  I see there is a user exit defined on AV10 but haven't been able to establish what code this exit triggers and would like to get to the AV09 code as it pretty much does what I want.  I don't want to limit the screen to a single work centre as I want to see all related operations as need to see the work centre utilization for whole order across multiple processes, to ensure end times of one operation corresponds to start of the next.
    I am also looking to prevent capacities being moved at all once the process order has been started as effectively this process is locked in at this point and you cannot physically reschedule the remaining time.  (I know I am only supposed to pose one question at a time, but I believe this will be controlled within same configuration)
    Any suggestions / advice welcome,
    Regards,
    Jez

    Hello Jez,
    AV10 calls, from what I have been able to find out, the same exit that menu option Functions -> User (so enhancement CY190001). However, I could not as yet find a way to know where the user has dropped the object (to do the check, and to be able to continue with AV09 afterwards). The enhancement documentation only mentions how to get more information about the object, but not about where it was dropped.
    I am trying to use this to solve http://scn.sap.com/thread/3534956.
    Have you managed to find anything else on your side?
    Regards,
    Rui

  • I cant "drag and drop" music onto my ipod anymore can i get help please???

    Hi,
    Since i have my ipod i have always dragged and dropped music from my itunes library onto my ipod but now every time i open itunes it tries to sync my whole library onto my ipod which i dont want, but now i cant drag nd drop onto it anymore , and there is a "lock" symbol beside the space that shows how much space is available on my ipod (such as the one that appears when on hold).
    Any help would be great, thank you
    Dell dimension 5000   Windows XP  

    "every time i open itunes it tries to sync my whole library onto my ipod which i dont want"
    You can use a keyboard command to prevent your iPod auto-syncing with iTunes. While connecting the iPod to the computer on Windows with iTunes 7 installed hold down the Control and Alt keys (or Shift + Ctrl keys in older versions). This will stop the iPod from auto-syncing with iTunes and the iPod will appear in the source list. Wait until you are sure the iPod has mounted, and that it will not auto sync and then you can let the keys go. This may take between 20 to 30 seconds depending on your computer: iTunes 7 Keyboard Shortcuts for Windows
    "but now i cant drag nd drop onto it anymore , and there is a "lock" symbol beside the space that shows how much space is available on my ipod"
    Grey text when you look at the content and lock symbol at the bottom of the screen simply shows that your iPod is set to automatically update. If you want to access your iPod directly, drag songs to it, play it through your iTunes, connect it to a second computer etc. you just need to change the update method to "Manually manage songs and videos" in the iPod Summary tab and click Apply. The text will change from grey to dark and the padlock will disappear: Managing content manually on iPod

  • Drag and drop images from document in pages 5.5

    Hey guys,
    So prior to updating my OS to Yosemite and my pages application to 5.5, i used to be able to select an image, hit the format button to the top right -> image tab and see the image file, then i could just drag and drop that file to my desktop (or wherever). Now i don't have that option? To get around this i've been renaming my file to a .zip and extracting it, but this is just a pain in the butt! Am i missing something, can i still do this and i just can't find it?
    Thanks!

    To be more precise, you can setup a JComponent or JPanel on top of your JavaFX nodes that has a TransferHandler that can convert the (AWT/Swing) images dragged to the app to JavaFX image and then insert it into the underlying node.
    As for the file chooser itselft: ListView and the JavaFX composer can allow you to create one quite easily. TreeView can aslso be used to a lesser extend (still a big buggy). For both of these, there are small bugs in the Cell API that may (or may not) prevent from displaying a proper thumbnail in the cells.
    You can also use a regular JFileChooser if you do not mind the dialog box having a different LnF from the rest of your application.

  • Drag and Drop (Trying to do a copy but it does a Move instead)?

    I have implemented drag and drop throughout my application and it works fine as long as I drag from a non-editable component (Table, TextArea, etc.) to an editable component (TextArea or TextField). However, When I drag and drop from an editable component to another editable component it does a move instead. How do I force it to do a copy? I looked at the description of exportAsDrag(JComponent comp, InputEvent e, int action) method and it even says for the action that no matter what you put in there "...the value may be changed during the course of the drag operation". What exactly causes this possible change and how do I prevent it from happening?
    This is the constructor I currently have:
    public TextAreaPanel(Document doc)
      super(doc);
      setMargin(new Insets(12,12,12,12));
      setDragEnabled(true);
      addMouseListener(new MouseAdapter()
        @Override public void mousePressed(MouseEvent e)
          if(e.getButton() != MouseEvent.BUTTON1)
            TextAreaPanel area = (TextAreaPanel)e.getSource();
            area.getTransferHandler().exportAsDrag(area, e, TransferHandler.COPY);
    }I forgot to mention before. The location of the component having the text copied into it is in a different JInternalFrame than the one where the text is being copied from (not sure if that matters or not).
    Edited by: Dont_Know on Jan 18, 2008 6:25 AM
    Edited by: Dont_Know on Jan 18, 2008 6:28 AM

    If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
    Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
    Connect the micro USB cable to the Apple TV and to your computer.
    Open iTunes.
    Select your Apple TV in the Source list, and then click Restore.

  • Using MouseMotionListener in order to have a drag and drop effect

    Hello,
    How is the exact syntax in order for the following code to work even for Drag and Drop effects of the drawn figures.
    package tpi;
    import java.awt.*;
    import java.awt.event.*;
    public class Desenare extends Frame{
         private Panel selPanel;
         private Choice sel;
         private Choice fond;
         private Choice lista;
         private MyCanvas canvas;
         public Desenare(String titlu){
              super(titlu);
              selPanel = new Panel(new GridLayout(6,1));
              Label label1 = new Label("Culoare");
              sel = new Choice();
              sel.addItem("Alb");
              sel.addItem("Albastru");
              sel.addItem("Verde");
              sel.addItem("Negru");
              sel.select(0);
              Label label2 = new Label("Figura");
              lista = new Choice();
              lista.addItem("Dreptunghi");
              lista.addItem("Linie");
              lista.addItem("Cerc");
              lista.select(0);
              Label label3 = new Label("Culoare Fond");
              fond = new Choice();
              fond.addItem("Negru");
              fond.addItem("Verde");
              fond.addItem("Albastru");
              fond.addItem("Alb");
              fond.select(0);
              IL itemListener = new IL();
              sel.addItemListener(itemListener);
              fond.addItemListener(itemListener);
              lista.addItemListener(itemListener);
              selPanel.add(label1);
              selPanel.add(sel);
              selPanel.add(label2);
              selPanel.add(lista);
              selPanel.add(label3);
              selPanel.add(fond);
              selPanel.setBackground(Color.LIGHT_GRAY);
              canvas = new MyCanvas();
              add("West",selPanel);
              add("Center",canvas);
              addWindowListener(new WA());
              setSize(400,300);
              setVisible(true);
         class WA extends WindowAdapter{
              public void windowClosing(WindowEvent e){
                   System.exit(0);
         class IL implements ItemListener{
              public void itemStateChanged(ItemEvent event){
              canvas.repaint();
         Color genCuloare(String culoare){
              Color color;
              if (culoare.equals("Negru")) color = Color.black;
              else if (culoare.equals("Verde")) color = Color.green;
              else if (culoare.equals("Albastru")) color = Color.blue;
              else if (culoare.equals("Alb")) color = Color.white;
              else color = Color.black;
              return color;
         class MyCanvas extends Canvas{
              public void paint(Graphics g){
              String culoare = sel.getSelectedItem();
              Color color = genCuloare(culoare);
              g.setColor(color);
              color = genCuloare(fond.getSelectedItem());
              setBackground(color);
              Dimension dim = getSize();
              int cx = dim.width/2;
              int cy = dim.height/2;
              String figura = lista.getSelectedItem();
              if (figura.equals("Linie"))
              g.drawLine(cx/2,cy/2,3*cx/2,3*cy/2);
              else if (figura.equals("Dreptunghi"))
              g.fillRect(cx/2,cy/2,cx,cy);
              else if (figura.equals("Cerc"))
              g.fillOval(cx/2,cy/2,cx,cy);
              ML listener = new ML();
              canvas.addMouseMotionListener(listener);
              public class ML implements MouseMotionListener{
                   @Override
                   public void mouseDragged(MouseEvent arg0) {
                        // TODO Auto-generated method stub
                   @Override
                   public void mouseMoved(MouseEvent arg0) {
                        // TODO Auto-generated method stub
              public static void main(String []args){
              Desenare d = new Desenare("Desenare 2D");
    Where exactly do i have to add the MouseMotionListener , i guess that i should add it to the canvas , and the inherited metod shoul be modified in order to use canvas.repaint() at the location where the draggin effect has ended, or if there is some other way when i press the mouse on the figure and start moving around to getX() and getY() and use the repaint method at those coordinates , wich is a drag and drop effect , i think that it would be MouseMoved , but i`m not sure, and also not sure how to use the Event Listener , where exactly ?
    Thanks,
    Paul

    When you post a code, use code tags for propere formatting. Click CODE icon on the taskbar for generating code tag pair you need.
    In order to do dragging the figure on the canvas or panel, you should use advanced Java 2D APIs, including Shape and its descendants. Example shown below might help, but beware, this version does not remember previous drag result for a figure over multiple lista Choice selection. Previous drag result is reset for the next selection of the same figure.
    If you want to prevent flickering on the screen while dragging, use javax.swing and its components. If you have to use AWT, draw the figure into an Image or BufferedImage of full panel size and call g2.drawImage() in the paint() method.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.event.*;
    public class Desenare extends Frame{
      private Panel selPanel;
      private Choice sel;
      private Choice fond;
      private Choice lista;
      private MyCanvas canvas;
      Color fcolor, bcolor;
      enum Fig{LINE, RECT, CIRCLE};
      Fig fig;
      int xL0, yL0, xL1, yL1;
      int xR0, yR0, xR1, yR1;
      int xC0, yC0, xC1, yC1;
      int dxL, dyL, dxR, dyR, dxC, dyC;
      Shape shape;
      public Desenare(String titlu){
        super(titlu);
        selPanel = new Panel(new GridLayout(6,1));
        fcolor = bcolor = Color.white;
        dxL = dyL = dxR = dyR = dxC = dyC = 0;
        Label label1 = new Label("Culoare");
        sel = new Choice();
        sel.addItem("Alb");
        sel.addItem("Albastru");
        sel.addItem("Verde");
        sel.addItem("Negru");
        sel.select(0);
        Label label2 = new Label("Figura");
        lista = new Choice();
        lista.addItem("Dreptunghi");
        lista.addItem("Linie");
        lista.addItem("Cerc");
        lista.select(0);
        Label label3 = new Label("Culoare Fond");
        fond = new Choice();
        fond.addItem("Alb");
        fond.addItem("Albastru");
        fond.addItem("Verde");
        fond.addItem("Negru");
        fond.select(0);
        IL itemListener = new IL();
        sel.addItemListener(itemListener);
        fond.addItemListener(itemListener);
        lista.addItemListener(itemListener);
        selPanel.add(label1);
        selPanel.add(sel);
        selPanel.add(label2);
        selPanel.add(lista);
        selPanel.add(label3);
        selPanel.add(fond);
        selPanel.setBackground(Color.LIGHT_GRAY);
        canvas = new MyCanvas();
        add(selPanel, BorderLayout.WEST);
        add(canvas, BorderLayout.CENTER);
        addWindowListener(new WA());
        setSize(400, 300);
        setVisible(true);
      class WA extends WindowAdapter{
        public void windowClosing(WindowEvent e){
          System.exit(0);
      class IL implements ItemListener{
        public void itemStateChanged(ItemEvent event){
          Object o = event.getSource();
          if (o == sel){
            String culoare = sel.getSelectedItem();
            fcolor = genCuloare(culoare);
            canvas.repaint();
          else if (o == fond){
            bcolor = genCuloare(fond.getSelectedItem());
            canvas.setBackground(bcolor);
          else if (o == lista){
            String figura = lista.getSelectedItem();
            if (figura.equals("Linie")){
              fig = Fig.LINE;
            else if (figura.equals("Dreptunghi")){
              fig = Fig.RECT;
            else if (figura.equals("Cerc")){
              fig = Fig.CIRCLE;
            shape = prepareShape(fig);
            canvas.repaint();
      Shape prepareShape(Fig fig){
        Shape shape = null;
        if (fig == Fig.LINE){
          shape = new Line2D.Float(xL0, yL0, xL1, yL1);
        else if (fig == Fig.RECT){
          shape = new Rectangle2D.Float(xR0, yR0, xR1, yR1);
        else if (fig == Fig.CIRCLE){
          shape = new Ellipse2D.Float(xC0, yC0, xC1, yC1);
        return shape;
      Shape prepareShapeDrag(Fig fig){
        Shape shape = null;
        if (fig == Fig.LINE){
          shape = new Line2D.Float(xL0 + dxL, yL0 + dyL, xL1 + dxL, yL1 + dyL);
        else if (fig == Fig.RECT){
          shape = new Rectangle2D.Float(xR0 + dxR, yR0 + dyR, xR1, yR1);
        else if (fig == Fig.CIRCLE){
          shape = new Ellipse2D.Float(xC0 + dxC, yC0 + dyC, xC1, yC1);
        return shape;
      Color genCuloare(String culoare){
        Color color;
        if (culoare.equals("Negru")){
          color = Color.black;
        else if (culoare.equals("Verde")){
          color = Color.green;
        else if (culoare.equals("Albastru")){
          color = Color.blue;
        else if (culoare.equals("Alb")){
          color = Color.white;
        else{
          color = Color.black;
        return color;
      class MyCanvas extends Canvas{
        public MyCanvas(){
          setBackground(Color.white);
          ML ml = new ML();
          addMouseListener(ml);
          addMouseMotionListener(ml);
        public void paint(Graphics g){
          Graphics2D g2 = (Graphics2D)g;
          setCoords();
          g2.setPaint(fcolor);
          if (shape != null){
            g2.draw(shape);
            g2.fill(shape);
        void setCoords(){
          int w = getWidth();
          int h = getHeight();
          xL0 = w / 4;
          yL0 = h / 4;
          xL1 = xL0 * 3;
          yL1 = yL0 * 3;
          xC0 = xR0 = xL0;
          yC0 = yR0 = yL0;
          xC1 = xR1 = w / 2;
          yC1 = yR1 = h / 2;
      public class ML extends MouseInputAdapter{
        Shape s = null;
        Point p0 = null;
        Point p1 = null;
        @Override
        public void mousePressed(MouseEvent e) {
          double dist = 0.0;
          p0 = p1 = e.getPoint();
          if (shape instanceof Line2D){
            dist = ((Line2D)shape).ptSegDist(p0);
            if (dist < 2){
              s = shape;
            else{
              s = null;
          else{
            if (shape.contains(p0)){
              s = shape;
            else{
              s = null;
        @Override
        public void mouseDragged(MouseEvent e) {
          int dx, dy;
          if (s != null){
            p0 = p1;
            p1 = e.getPoint();
            dx = p1.x - p0.x;
            dy = p1.y - p0.y;
            if (s instanceof Line2D){
              dxL += dx;
              dyL += dy;
            else if (s instanceof Rectangle2D){
              dxR += dx;
              dyR += dy;
            else if (s instanceof Ellipse2D){
              dxC += dx;
              dyC += dy;
            shape = Desenare.this.prepareShapeDrag(fig);
            canvas.repaint();
      public static void main(String []args){
        Desenare d = new Desenare("Desenare 2D with Dragging support");
    }

  • ADF Button components: How to disable drag and drop [SOLVED]

    Hi everyone
    I need to develop an application which allows not the user to drag and drop button components. I've converted every single af:commandbutton to h:commandbutton, to prevent this behaviour, but a huge lot of other problems arose from this "solution". I'm using JDeveloper 10.1.3.3.0.4157, and I'm a beginner, so please be patient with me.
    Thanks in advance.

    Maybe I've drifted off-topic with this, but I found the way to achieve this. The only limitation is that the change must be done on the client's computer. The drag and drop feature can be disabled by going to the about:config page in Firefox, and setting nglayout.enable_drag_images to false. It can also be done in a more "portable" way by creating a user.js script in the profile folder and setting it from there. Thank you all for stopping by and reading.

  • Drag and drop Firefox issue

    I've encountered a rather annoying problem with drag and drop. Firefox will always accept a drop of a custom component! For example run and drag and drop in firefox:
    http://java.sun.com/docs/books/tutorialJWS/uiswing/dnd/ex6/DragPictureDemo.jnlp
    Do you know anyway to prevent this (I know IE does not accept the drop...)?
    Thanks very much for any input!

    I have an applet in a webpage that will accept drag
    and drops, however, if a user mistakingly drops into
    the browser page and not the applet, the drop is
    consumed, which is bad especially if you want an
    action to occur whenever a drop happens...
    :(Okay, but the applet provides a target area. So how is it any different from dropping said content on any other app that's in a background window? Make sure the drop area is visually obvious.
    Of course, if Firefox is taking this to be a file to show and then unloading the applet, that is not ideal. But I personally would not worry about such a thing happening that I felt a need to jump thru hoops to find a solution.
    In my opinion this would be a Firefox bug, but was
    wondering if there is a Java workaround. I guess I
    could tell people to just use IE.....You could restrict to IE other ways too, but I really don't see the point. I don't know any other way to change the type except what you already posted. FireFox does support running Java from within Javascript, so this might be a side effect of that.
    Message was edited by:
    bsampieri

  • Drag and drop from/to JTable

    Hi,
    I am trying to implement drag and drop between two JTables. I have two questions about this and I hope you can help me.
    1. I would like to prevent the user from droping an Object in the same JTable as the object came from in the first place. How can I do that?
    2. How can I drop an Object in a JTable if there isn�t any rows in the table?
    I am using jdk 1.4.
    Thanks!!!
    :-)Lisa

    I think you just use setDragEnabled(true) on both tables.
    If not, then maybe this link will help:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html

Maybe you are looking for

  • How to store the return value from a select list in page item ?

    I'm sorry, I'm sure you will all flame me for this (and its long too :-(. I'm still trying to pick this up and havn't had time to read manual and this forum and up against the clock (as usual), but this must be something thats simple to do, otherwise

  • Airport Express (Model with 802.11G +54MBPS Mac/PC and Set Up Issues

    Hi, We have a 4 Mac and 1 PC Household. Cable Internet Service by Roadrunner.Cable model (owned) connected to a D-Link 802.11G wi fi router (by ethernet from cable modem)in the family room , then out to a Imac (the half moon base and LCD screen with

  • The ipod cannot be ejected because it contains files that are in use by another application

    I am using my crusty but trusty 5G iPod with my new rMPB, and things have been working as expected for the month or so that I've had the new laptop. But "recently," (past few days?), when I go to eject from iTunes (current - 11.1.5), I get the error

  • Excel crashes after sending mail (Office 365 Pro Plus)

    Hello All, A user reported that Excel crashes after sending mail. Excel is part of Office 365 Pro Plus and is fully update  (Feb 2015). Also there is no add-in enabled. Is there a way to raise a log or fix this issue?. Regards JO

  • Sql file in Weblogic6.1

    Hi, all: I am going to develop an cmp bean . I create a data pool and I need put tables into it. I have the sql files. Should I put them into the Data source folder of the Weblogic? And how can I do it? I am using Weblogic 6.1. Thanks for help