How to add text to a drag and drop object

Hi everyone, I am quite a beginner with Flash so do excuse
me. First, I am not sure if what I want to achieve may actually be
impossible with Flash. I presently use MX 2004, but will shortly be
upgrading to CS3. But if you know the answer for MX 2004 that would
be really useful for now.
I am writing a digital fiction story, and I want to create
drag and drop objects. This I have managed to do. But I would like
these drag and drop objects to also reveal text when they are
actually pressed on. I have had no success so far in being able to
achieve the two effects together.
Does anyone know how I can achieve this? If, by chance, you
know the action script that would be great. If you can explain to
me in simple terms how I can achieve this I really would be
grateful.
Thanking you,
Mary

The script I posted would work on the main timeline - not in
the timeline of the clip itself.
So you made a movieclip out of the image and gave it the
instance name "myclip". That's good.
You edited that clip and added a dynamic text box with
instance name "mytext". Be careful not to confuse the "instance"
name of the text box with the "Var:" name. "myclip" should be the
instance name. Also be careful to make sure you uncheck the
"selectable" box. Edit your clip and click on the textbox to select
it and look in the properties panel. There should be a button with
Ab on it. If it is white background (highly likely), click it so it
is not white. If the text is selectable, it will interfere with
your button functions.
While there is nothing wrong with creating nested clips
within your movieclips, unless you plan to target them for
something, there is no benefit. The only thing that needs an
instance name inside the myclip is the textbox (based on what you
are trying to do).
You don't need any actionscript in the movieclip itself. If
you can learn to place all your AS on the root timeline, you will
be well ahead.
If you placed that AS inside the clip, Flash wouldn't know
what to do with it.
Technically you can place the AS inside the clip on the layer
you created but, if you did that, you would need to modify the
script to the following:
this.onPress = function() {
this.mytext.text = "stop pressing so hard";
startDrag(this);
this.onRelease = function() {
this.mytext.text = "";
stopDrag();

Similar Messages

  • Rollover text on a drag and drop object

    Hi folks, I wondered if someone could help me with this
    problem. Last week I was adding text to a drag and drop object on
    the press of a button and release of a button. This week, I am
    trying to get the drag and drop object to reveal text when the
    mouse rolls over it and again when the mouse releases it. I thought
    it should be pretty easy to fathom out the script for this, because
    I was given a lot of help last week. But I put in the attached
    code, and the object does not drag and drop, and neither does it
    show any text when the mouse rolls over it and off it.
    Can anyone tell me what I am doing wrong?
    Thanking you,
    Marchan

    The script I posted would work on the main timeline - not in
    the timeline of the clip itself.
    So you made a movieclip out of the image and gave it the
    instance name "myclip". That's good.
    You edited that clip and added a dynamic text box with
    instance name "mytext". Be careful not to confuse the "instance"
    name of the text box with the "Var:" name. "myclip" should be the
    instance name. Also be careful to make sure you uncheck the
    "selectable" box. Edit your clip and click on the textbox to select
    it and look in the properties panel. There should be a button with
    Ab on it. If it is white background (highly likely), click it so it
    is not white. If the text is selectable, it will interfere with
    your button functions.
    While there is nothing wrong with creating nested clips
    within your movieclips, unless you plan to target them for
    something, there is no benefit. The only thing that needs an
    instance name inside the myclip is the textbox (based on what you
    are trying to do).
    You don't need any actionscript in the movieclip itself. If
    you can learn to place all your AS on the root timeline, you will
    be well ahead.
    If you placed that AS inside the clip, Flash wouldn't know
    what to do with it.
    Technically you can place the AS inside the clip on the layer
    you created but, if you did that, you would need to modify the
    script to the following:
    this.onPress = function() {
    this.mytext.text = "stop pressing so hard";
    startDrag(this);
    this.onRelease = function() {
    this.mytext.text = "";
    stopDrag();

  • How to add pdf acrofield by drag and drop in browser

    i want to add pdf acrofield by drag and drop in browser.Help me.

    Any other way to achieve this concept?

  • How do I set up my drag and drop questionaire to export to a XML file?

    How do I set up my drag and drop questionaire to export to a
    XML file?
    I have a 70 seperate SWF files that pose a question and
    contain a drag and drop rank order response of 1,2,3,4.How do I set
    up a XML file that receives the responses.I don't understand how to
    do the Actionscript
    and get my responses to connect to the XML.Please
    Help!Thanks!
    Here's an example of my XML.
    <assessment>
    <sessionid>ffae926ea290ee93c3f26669c6c04a92</sessionid>
    <request>save_progress</request>
    <question>
    <number>1</number>
    <slot_a>2</slot_a>
    <slot_b>1</slot_b>
    <slot_c>4</slot_c>
    <slot_d>3</slot_d>
    </question>
    <question>
    <number>2</number>
    <slot_a>4</slot_a>
    <slot_b>3</slot_b>
    <slot_c>2</slot_c>
    <slot_d>1</slot_d>
    </question>
    <question>
    <number>3</number>
    <slot_a>1</slot_a>
    <slot_b>2</slot_b>
    <slot_c>3</slot_c>
    <slot_d>4</slot_d>
    </question>
    </assessment>

    Use XML.sendAndLoad.
    http://livedocs.macromedia.com/flash/8/main/00002879.html
    You will need a server script to receive the XML structure
    and it depends on
    the server scripting language how you obtain that data. Then
    you can either
    populate a database or write to a static file or even email
    the XML data
    received from Flash.
    For a basic example, I have two links I use for students in
    my Flash
    courses:
    http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLASP/Ex01/XMLASPEchoEx01_D oc.php
    http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHP/EX01/XMLPHPEchoEx01_D oc.php
    Lon Hosford
    www.lonhosford.com
    May many happy bits flow your way!
    "kenpoian" <[email protected]> wrote in
    message
    news:e5i9hp$cs6$[email protected]..
    How do I set up my drag and drop questionaire to export to a
    XML file?
    I have a 70 seperate SWF files that pose a question and
    contain a drag and
    drop rank order response of 1,2,3,4.How do I set up a XML
    file that receives
    the responses.I don't understand how to do the Actionscript
    and get my responses to connect to the XML.Please
    Help!Thanks!
    Here's an example of my XML.
    <assessment>
    <sessionid>ffae926ea290ee93c3f26669c6c04a92</sessionid>
    <request>save_progress</request>
    <question>
    <number>1</number>
    <slot_a>2</slot_a>
    <slot_b>1</slot_b>
    <slot_c>4</slot_c>
    <slot_d>3</slot_d>
    </question>
    <question>
    <number>2</number>
    <slot_a>4</slot_a>
    <slot_b>3</slot_b>
    <slot_c>2</slot_c>
    <slot_d>1</slot_d>
    </question>
    <question>
    <number>3</number>
    <slot_a>1</slot_a>
    <slot_b>2</slot_b>
    <slot_c>3</slot_c>
    <slot_d>4</slot_d>
    </question>
    </assessment>

  • How come in Pages, i cannot drag and drop images?

    how come in Pages, i cannot drag and drop images?

    Yes you can in all versions.
    It helps if you actually describe what you are doing.
    Where are you dragging it from and where are you dragging it to?
    In what version of Pages?
    I suspect you are trying to drag an image into a Table, Header or Footer in Pages 5, which is no longer possible. Feature removed by Apple.
    Peter

  • How to outline selected cells during drag and drop in the jtable

    Hi,
    I have spent a lot of time to find out how to outline selected cells during drag in the jtable, but I did not find the answer.
    Can anybody give me a tip, where to read more about this problem or even better, give an example...
    I have the following situation:
    1.Table has 10 rows and 10 columns
    2.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION) and setCellSelectionEnabled(true)
    3.user select 5 cells in 4th row (for example cell45,cell46,cell47,cell48 and cell49)
    4.user starts dragging. During dragging an outline should be drawn. Outline should be a rectangular with width of 5 cells and height of one cell. Outline should move according to the mouse position.
    5.rectangular disappears when dropped
    Regards,
    Primoz

    In "createTransferable" you can create a drag image
    which you can paint in "dragOver" and clear in "drop" method of DropTarget :
    package dnd;
    * DragDropJTableCellContents.java
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    public class DragDropJTableCellContents extends JFrame {
        public DragDropJTableCellContents() {
            setTitle("Drag and Drop JTable");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            getContentPane().add(createTable("JTable"), BorderLayout.CENTER);
            setSize(400, 300);
            setLocationRelativeTo(null);
        private JPanel createTable(String tableId) {
            DefaultTableModel model = new DefaultTableModel();
            for (int i = 0; i < 10; i++) {
                model.addColumn("Column "+i);
            for (int i = 0; i < 10; i++) {
                String[] rowData = new String[10];
                for (int j = 0; j < 10; j++) {
                    rowData[j] = tableId + " " + i + j;
                model.addRow(rowData);
            JTable table = new JTable(model);
            table.getTableHeader().setReorderingAllowed(false);
            table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            table.setCellSelectionEnabled(true);
            JScrollPane scrollPane = new JScrollPane(table);
            table.setDragEnabled(true);
            TableTransferHandler th = new TableTransferHandler();
            table.setTransferHandler(th);
            table.setDropTarget(new TableDropTarget(th));
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            JPanel panel = new JPanel(new BorderLayout());
            panel.add(scrollPane);
            panel.setBorder(BorderFactory.createTitledBorder(tableId));
            return panel;
        public static void main(String[] args) {
            new DragDropJTableCellContents().setVisible(true);
        abstract class StringTransferHandler extends TransferHandler {
            public int dropAction;
            protected abstract String exportString(JComponent c);
            protected abstract void importString(JComponent c, String str);
            @Override
            protected Transferable createTransferable(JComponent c) {
                return new StringSelection(exportString(c));
            @Override
            public int getSourceActions(JComponent c) {
                return COPY;
            @Override
            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;
            @Override
            public boolean canImport(JComponent c, DataFlavor[] flavors) {
                for (int ndx = 0; ndx < flavors.length; ndx++) {
                    if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
                        return true;
                return false;
        class TableTransferHandler extends StringTransferHandler {
            private int dragRow;
            private int[] dragColumns;
            private BufferedImage[] image;
            private int row;
            private int[] columns;
            public JTable target;
            @Override
            protected Transferable createTransferable(JComponent c) {
                JTable table = (JTable) c;
                dragRow = table.getSelectedRow();
                dragColumns = table.getSelectedColumns();
                createDragImage(table);
                return new StringSelection(exportString(c));
            protected String exportString(JComponent c) {
                JTable table = (JTable) c;
                row = table.getSelectedRow();
                columns = table.getSelectedColumns();
                StringBuffer buff = new StringBuffer();
                for (int j = 0; j < columns.length; j++) {
                    Object val = table.getValueAt(row, columns[j]);
                    buff.append(val == null ? "" : val.toString());
                    if (j != columns.length - 1) {
                        buff.append(",");
                return buff.toString();
            protected void importString(JComponent c, String str) {
                target = (JTable) c;
                DefaultTableModel model = (DefaultTableModel) target.getModel();
                String[] values = str.split("\n");
                int colCount = target.getSelectedColumn();
                int max = target.getColumnCount();
                for (int ndx = 0; ndx < values.length; ndx++) {
                    String[] data = values[ndx].split(",");
                    for (int i = 0; i < data.length; i++) {
                        String string = data;
    if(colCount < max){
    model.setValueAt(string, target.getSelectedRow(), colCount);
    colCount++;
    public BufferedImage[] getDragImage() {
    return image;
    private void createDragImage(JTable table) {
    if (dragColumns != null) {
    try {
    image = new BufferedImage[dragColumns.length];
    for (int i = 0; i < dragColumns.length; i++) {
    Rectangle cellBounds = table.getCellRect(dragRow, i, true);
    TableCellRenderer r = table.getCellRenderer(dragRow, i);
    DefaultTableModel m = (DefaultTableModel) table.getModel();
    JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
    table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
    lbl.setBounds(cellBounds);
    BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
    BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D graphics = img.createGraphics();
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
    lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    lbl.paint(graphics);
    graphics.dispose();
    image[i] = img;
    } catch (RuntimeException re) {
    class TableDropTarget extends DropTarget {
    private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
    private Rectangle rect2D = new Rectangle();
    private TableTransferHandler handler;
    public TableDropTarget(TableTransferHandler h) {
    super();
    this.handler = h;
    @Override
    public void dragOver(DropTargetDragEvent dtde) {
    handler.dropAction = dtde.getDropAction();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    int row = table.rowAtPoint(location);
    int column = table.columnAtPoint(location);
    table.changeSelection(row, column, false, false);
    paintImage(table, location);
    autoscroll(table, location);
    super.dragOver(dtde);
    public void dragExit(DropTargetDragEvent dtde) {
    clearImage((JTable) dtde.getDropTargetContext().getComponent());
    super.dragExit(dtde);
    @Override
    public void drop(DropTargetDropEvent dtde) {
    Transferable data = dtde.getTransferable();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    clearImage(table);
    handler.importData(table, data);
    super.drop(dtde);
    private final void paintImage(JTable table, Point location) {
    Point pt = new Point(location);
    BufferedImage[] image = handler.getDragImage();
    if (image != null) {
    table.paintImmediately(rect2D.getBounds());
    rect2D.setLocation(pt.x - 15, pt.y - 15);
    int wRect2D = 0;
    int hRect2D = 0;
    for (int i = 0; i < image.length; i++) {
    table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
    pt.x += image[i].getWidth();
    if (hRect2D < image[i].getHeight()) {
    hRect2D = image[i].getHeight();
    wRect2D += image[i].getWidth();
    rect2D.setSize(wRect2D, hRect2D);
    private final void clearImage(JTable table) {
    table.paintImmediately(rect2D.getBounds());
    private Insets getAutoscrollInsets() {
    return autoscrollInsets;
    private void autoscroll(JTable table, Point cursorLocation) {
    Insets insets = getAutoscrollInsets();
    Rectangle outer = table.getVisibleRect();
    Rectangle inner = new Rectangle(outer.x + insets.left,
    outer.y + insets.top,
    outer.width - (insets.left + insets.right),
    outer.height - (insets.top + insets.bottom));
    if (!inner.contains(cursorLocation)) {
    Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
    cursorLocation.y - insets.top,
    insets.left + insets.right,
    insets.top + insets.bottom);
    table.scrollRectToVisible(scrollRect);
    Edited by: Andre_Uhres on Nov 18, 2007 10:03 PM

  • How to use the palette or drag and drop functions in netbean?

    Is there anyone who can help me out on using drag and drop function in netbean to design GUI inteface..??
    Is palette is the tool that can be used to drag and drop.??
    thank you in advance.

    I actually really like the GUI builder in netbeans. I used to be a big eclipse user so I am very familiar with coding GUIs by hand, and most of what I do involves GUI's or at least swing.
    At first I hated netbeans, I hated that I couldn't edit the code most. Then I decided to take a deep breath and really examine the issue. What I discovered is that most of the edits I wanted to make but couldn't really weren't the right way to be doing it in the first place, for the rest the code is actually really easy to change you just have to know how.
    Now my palette is huge, probably about 250 objects in it organized into sections that work for me. Basically if I want a object to do something that is not already in the palette I simply write a new object and add it to the palette. I started small like with rounded buttons/progress bars, and as I got comfortable I now have some fairly advanced objects like grids, isometric grids, alpha composits, an animated hourglass countdown timer, and an animated "loading/activity" indicator that is not tied to a progress indicator.
    The main reason I stuck with the netbeans drag and drop GUI builder is it's layout manager is really a very nice layout manager, you couldn't pay me enough to go back to eclipse or codeing GUIs by hand, as I can now do in one day what used to take me several weeks.
    So what I am saying is stick with netbeans and the drag and drop, it sucks at first, but once you get to a point where you are comfortable with it and adding to the palette it will become a great tool.
    JSG

  • How to display xy coordintes of drag and drop movie

    can someone tell me how to display the coordinates of the red
    cirle shown in the drag and drop tutorial found here:
    http://www.flashvalley.com/fv_tutorials/advanced_drag_and_drop_in_Flash/
    I have done this tutorial just fine but dont know how to
    display its x and y coordinatetes in a dynamic text box as i move
    the red circle around the screen.
    thank you for any assistance you may give.
    steve

    Hi kglad,
    I dont suppose you could show me how to create the loop? My
    own research seems to indicate the onEnterFrame method would be
    easiest.
    I am just a beginner and even this is still beyond me.
    thanks

  • HT2518 how do i or can i drag and drop files from one external drive to another ???HOW

    how do i drag and drop files from one external drive to another, i cannt get both drives to open up. only one at a time.. i have alot to learn i know but that is where i am at the time...

    You posted here so would assume you are also talking about running Windows.
    Are the drives NTFS and use on Windows?
    Are they Mac HFS formatted?
    You likely will need NTFS for OS X in one case. to mount PC and use under Mac OS Lion
    MacDrive to mount and WRITE to HFS drives under Windows

  • How to Create Table Using Column Drag and Drop Feature

    Hi:
    I am new to Oracle SQL dev Data Modeler tool and would like to know if there is a way to create a new table by re-using the existing columns or column groups. The idea is to maintain consistency and save table design time. If columns created previously can be re-used and require drag and drop of column in the right pane, then only new columns need to be manually created.
    Any thoughts on this will be appreciated.
    Thanks!

    Hi Kent
    I checked out the video and tried it in Oracle designer, it works and works great!
    My other question is that I may have several set of columns that I may want to group depending on the table requirements. Can I have multiple templates and choose which one to apply to?
    Also, how do I choose the table where the table template needs to be applied. As I may be interested in applying the table template to selected tables only.
    Thanks
    Edited by: user648132 on Feb 20, 2012 10:47 AM

  • How can I build an animated drag and drop multimeter lead using Flash?

    I am building a virtual multimeter for testing simulated circuits. I would like to be able to drag an animated multimeter test lead to a point in the circuit and drop it on a target. The static drag and drop is not my issue. I would like some suggestions on how I can animate the movement of the lead itself. Any suggestions would be appreciated.

    you want something to "follow the mouse" but not be dragged?
    if yes, use a loop (enterframe) and ease the object's position to the mouse:
    object.x+=speed*object.x+(1-speed)*mouseX;

  • How I create a label with drag and drop?

    I have the next...
    I want to be able to move to a label (drag and drop) of swing in my panel contained in jframe.
    I already identify the position of the mouse with the method mouseMoved
    With the method ---jButton1ActionPerformed--- that I assign to each button I identify the selected component
    With the property setBounds of the button I assign the new hubicaci�n of the button.
    My questions:
    This good which I am doing?
    Like sending in value X and the value to him and of the position of the mouse to the button?
    Help me, please
    NOTE: in the example comence using JButton, but must be labels.
    import java.awt.dnd.DropTarget;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import javax.swing.JButton;
    * @author Administrador
    public class MYCLass extends javax.swing.JFrame implements MouseMotionListener {
    private int coorX, coorY;
    private JButton general = null;
    /** Creates a new instance of MYCLass */
    public MYCLass() {
    System.out.println("Layout " + this.getContentPane().getLayout());
    this.getContentPane().setLayout(null);
    addMouseMotionListener(this);
    JButton jb = new JButton("1.- El botonsito");
    JButton jb2 = new JButton("2.- El botonsito");
    jb.setBounds(16,100,100,25);
    jb2.setBounds(16,280,100,25);
    jb.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jb2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    this.getContentPane().add(jb);
    this.getContentPane().add(jb2);
    this.pack();
    this.setSize(300, 600);
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    if (this.isFocusable()) {
    System.out.println("POSICION X " + coorX);
    System.out.println("POSICION y " + coorY);
    // general = (JButton) ((javax.swing.JPanel) this.getContentPane().getC).getComponentAt(coorX,coorY);
    System.out.println(" boton genral tiene valor: " + general );
    // this.setBounds(coorX,coorY,100,25);
    System.out.println("Obtuvo el foco.... " + evt.getActionCommand());
    // this.getComponentAt();
    // System.out.println("Obtuvo el nombre... " + this.getName());
    public void mouseDragged(MouseEvent e) {
    repaint( );
    public void mouseMoved(MouseEvent e) {
    if(e.getClickCount() == 2) {
    System.out.println("Se presiono 2 veces el MOUSE");
    coorX = e.getX();
    coorY = e.getY();
    System.out.println("POSICION X " + coorX);
    System.out.println("POSICION y " + coorY);
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new MYCLass().setVisible(true);
    }

    Hello!!!!
    I have the next......
    It modifies it and I am of the following form
    Give its opinion me, thanks!!!!
    import java.awt.dnd.DropTarget;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    * @author Administrador
    public class MYCLass extends javax.swing.JFrame implements MouseMotionListener {
    private int coorX, coorY;
    private JLabel labelPrincipal = null;
    /** Creates a new instance of MYCLass */
    public MYCLass() {
    System.out.println("Layout " + this.getContentPane().getLayout());
    this.getContentPane().setLayout(null);
    addMouseMotionListener(this);
    JLabel jl1 = new JLabel("1.- Etiqueta... ");
    JLabel jl2 = new JLabel("2.- Etiqueta... ");
    jl1.setBounds(16,100,100,25);
    jl2.setBounds(16,280,100,25);
    jl1.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    System.out.println("Click");
    System.out.println("Source... " + e.getSource());
    labelPrincipal = (JLabel) e.getSource();
    labelPrincipal.setText("Texto especial .....");
    jl2.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    System.out.println("Click");
    System.out.println("Source... " + e.getSource());
    labelPrincipal = (JLabel) e.getSource();
    labelPrincipal.setText("Cambia tu texto.....");
    this.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    formMouseClicked(evt);
    this.getContentPane().add(jl1);
    this.getContentPane().add(jl2);
    this.pack();
    this.setSize(300, 600);
    private void formMouseClicked(java.awt.event.MouseEvent evt) {
    if (evt.getClickCount() == 2) {
    // labelPrincipal.setBounds(coorX,coorY,120,25);
    System.out.println( "PRESIONO EL MOUSE.. " + evt.getClickCount());
    labelPrincipal = null;
    public void mouseDragged(MouseEvent e) {
    public void mouseMoved(MouseEvent e) {
    if (labelPrincipal != null) {
    coorX = e.getX();
    coorY = e.getY();
    System.out.println("POSICION X " + coorX);
    System.out.println("POSICION y " + coorY);
    labelPrincipal.setBounds(coorX-1,coorY-35,120,25);
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new MYCLass().setVisible(true);
    }

  • How to change the effect of drag and drop from MOVE to COPY in alv tree.

    Hi,
    I am using a tool in which now the behaviour on drag and drop is MOVE. I want to change it to COPY.
    But I do not know which parameter needs to be set and where.
    please help.
    Regards,
    Smita.

    Hi,
    Thanks for quick reply.
    The code goes on like this
    METHOD set_dd_behavior.
      DATA: l_copysrc(1) TYPE c,
            l_movesrc(1) TYPE c,
            l_droptarget(1) TYPE c.
    Set the Drag and Drop Flavors.
      CREATE OBJECT dd_behavior.
      READ TABLE reg_functions WITH KEY name_function = 'COPY'
      TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        l_copysrc = 'X' .
      ENDIF.
      READ TABLE reg_functions WITH KEY name_function = 'CUT'
      TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        l_movesrc = 'X' .
      ENDIF.
      READ TABLE reg_functions WITH KEY name_function = 'PASTE'
      TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        l_droptarget = 'X' .
      ENDIF.
      CALL METHOD dd_behavior->add
      EXPORTING
      flavor = 'MOVE'
      dragsrc = l_movesrc
      droptarget = l_droptarget
      effect = cl_dragdrop=>move.
      CALL METHOD dd_behavior->add
      EXPORTING
      flavor = 'COPY'
      dragsrc = l_copysrc
      droptarget = l_droptarget
      effect = cl_dragdrop=>copy.
      CALL METHOD dd_behavior->get_handle
      IMPORTING handle = dd_behavior_handle.
    ENDMETHOD.
    Here what changes needs to be done.
    As I see once COPY is added and next time MOVE is added.
    I am able to check because I am not able to edit while debugging the value of effect.
    Please suggest.
    Warm regards,
    Smita.

  • How to play a sound on drag and drop?

    I've been tasked with creating a drag and drop game for College, and I would like to make it so that when an object is picked up/clicked on, a small 'pop' sound will play, and when it is successfully placed on a target, a slightly different 'pop' sound will play.
    I'm using ActionScript 2.0 on Flash CS5.5.
    I've got the drag and drop done, I just need to add the sound counterpart. I've seen some tutorials, but they're way too vague for me.

    Thanks a lot for that! Managed to get it to work finally.
    Sorry for the late response, I've only just decided to get back to doing the work.

  • How to change mouse cursor during drag and drop

    Hi Guys,
    Iam performing a Drag and drop from Table1(on top of the figure) to Table2(down in the figure).
    see attached figure
    http://www.upload-images.net/imagen/e80060d9d3.jpg
    Have implemented the Drag and drop functionality using "Transferable" and "TransferHandler"using the java tutorial
    http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo
    Now My problem is that ,I want to make the 1st column in Table2(ie: Column2-0) not to accept any drops so that the cursor appears like a "No-Drop" cursor but with selection on the column cell during a drop action.
    Also when I move my cursor between "column2-0" and "column2-1",want to to have the "No-Drop" and "Drop" cursor to appear depending on the column.
    How can I achieve it using the TransferHandle class.Dont want to go the AWT way of implementing all the source and target listeners on my own.
    Have overridded the "CanImort" as follows:
    public boolean canImport(JComponent c, DataFlavor[] flavors) {
         JTable table = (JTable)c;      
    Point p = table.getMousePosition();
    /* if(p==null)
         return false;
    int selColIndex = table.columnAtPoint(p);
    if(selColIndex==0)
         return false;*/
    If I execute the above commented code,The "No-Drop" Icon appears in "column2-0",but no cell selection.Also If I move to "column2-1",which is the 1st column,Still get the "No-Drop" Icon there,also with no cell selection.
    for (int i = 0; i < flavors.length; i++) {
    if ((DataFlavor.stringFlavor.equals(flavors))) {
    return true;
    return false;
    Thanks in advance.....
    Edited by: Kohinoor on Jan 18, 2008 3:47 PM

    If you found the selection column based on the mouse pointer, then based on the column, you can set the cursor pointer as any one as below :
    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    setCursor(new Cursor(Cursor.HAND_CURSOR));

Maybe you are looking for

  • How do I save the Combine Files Into PDF steps?

    I have a set of steps that I would like to repeat in the Combine Files into PDF screen, but I can not figure out how to save that definition file. I am using Adobe Acrobat Pro 10. Thanks,

  • How to reserve the material ( Make to Stock) for selective customers?

    Dear Friends, I want to reserve the material which is a Make to Stock for selective customers i.e if the customer base is 100 I want to reserve the certain quantity for 3 customers. It is a Make to Stock. Thanks in advance. Regards, Shrikant

  • Longtext update on BusiPartner via LSWM

    Hi, we are using in LSMW CRMXIF_PARTNER_SAVE for updating long texts on business partner (bp). it works, but alreadyexistent_ long texts on bp will be overwritten by LSMW (so we lost them!). Have anybody a hint how to avoid this? We need an update(=a

  • Can't install After Effects trial but can install other Adobe programs?

    Hi, I've been trying to download the After Effects trial on my Vista for the past two hours to no avail, with "Error 107". I've tried the troubleshooting on your website, following "Solution 1", clearing cookies, deleting files, trying the download t

  • Default Radio button

    Hi Guru's I have a standard selection screen. (PNP logical db) It has around 6 radio buttons I need to keep one of them as default. How can i do this? Maximum points will be awarded.. Regards