Drag Drop « Drag Drop « Java Swing Q&A





1. Swing: Creating a draggable component...?    stackoverflow.com

I searched the web for examples of draggable Swing components, but I found either incomplete or non-working examples. What I need is a Swing component that can be dragged by the mouse inside an ...

2. Drag&Drop with swing    stackoverflow.com

I need some help. Is it possible to simulate a drag & drop without registering a component?
E.g. I click the mousekey anywhere on the window and hold the mousekey down, at ...

3. How to drag-and-drop on custom Swing components    stackoverflow.com

How can I implement drag and drop on custom components, e.g. my own JPanel subclasses? What I need is full Swing-like drag and drop support. With TransferHandlers, DropTargetListeners etc. So the trivial ...

4. Drag and Drop Java GUI    stackoverflow.com

I am looking to create a GUI in Java, where I place controls or elements on a left pane and can drag them onto a designer pane, similar to creating a ...

5. I wrote a program using Drag and Drop in java, I need few updation in this. Can anyone help me please?    stackoverflow.com

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class scjp extends TransferHandler
{
JTextField txtField;
JRadioButton lbl=new JRadioButton("Hello");
public static void main(String[] args)
{
scjp sdd = new scjp();
transfer th=new transfer(); 

}

public scjp()
{

MouseListener ml = new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
JComponent jc ...

6. Flickering while dragging in Swing    stackoverflow.com

I have such code:

public class DpDropTargetListener implements DropTargetListener {
   public void dragOver(final DropTargetDragEvent dtde) {
      ...
      if (dtde.getLocation().equals(container.getLastLocation())) {
 ...

7. Drag and drop gui designer    forums.netbeans.org

hi i was told that i can take the "netbeans out of netbeans" and be left with just the framework , so i was wondering if i can add components that ...

8. can not change initComponents method at swing development using drag drop facility in nb 6.9    forums.netbeans.org

i want to have a pane which has vertical and horizontal scroll bars in a jframe. i want to show some diagrams in this pane. i tried it by draging and droping but when i run my program when i change the position of scroll bars my diagram in the pane breaks down and goes slightly mad. i saw a code ...

9. Drag 'n Drop in Java    coderanch.com





10. Bean drag and drop    coderanch.com

Hi I've designed a bean and I've added the bean onto the component library so that I can drag and drop the bean like any of the other swing components. I've already written a ComponentResized event for the bean. But when I drag and drop the bean into an applet, and resize it during design time(like we do with buttons, labes ...

11. Bean drag and drop problem .. Please help !!    coderanch.com

Hi I have a bean and I've added the bean to the Visual Cafe component library which means that I can drag and drop the bean like any other swing components such as buttons, labels etc. So, when I specify the properties of the bean in the property list, the bean should resize accordingly.But, when I try this, the bean is ...

12. dragndrop    coderanch.com

13. dragndrop    coderanch.com

14. Drag and Drop    coderanch.com

Thanks for your response... I run it thru visual age(JDK1.2). When I run this example as a separate application it works fine.... all the events get fired. the problem is when I add this to my actual application and run it. dropover doesnt get fired but dragexit and dragend gets fired. everything is fine on the drag side but not on ...

15. Drag and Drop    coderanch.com

16. Drag & Drop funda's needed    coderanch.com





17. Drag & Drop    coderanch.com

18. Drag and Drop question    coderanch.com

How can I distinquish between two drag sources of the same data type? Both sources are Vectors, each of which is wrapped in it's own Transferrable as well as being assigned unique Data Flavors. However, inside the Drop() method where I ask isDataFlavorSupported( myFlavor), no distinction is made between the DataFlavor names. Any help in resolving this issue is greatly appreciated. ...

19. Drag and drop!    coderanch.com

20. Drag and Drop    coderanch.com

21. Drag and Drop    coderanch.com

22. Drag and Drop Problem on the "drop"...    coderanch.com

23. COMPONENT Drag and Drop    coderanch.com

I have looked through all the API's and searched the web, but can't seem to find a way to Drag and Drop a component, such as a JButton in SWING. All the examples I find are for data and I don't know how to make them work for a component. Could someone please point me to or show me some code ...

24. Drag and Drop Swing Components    coderanch.com

25. Drag and drop    coderanch.com

26. Urgent:Problem using the drag and drop feature in solaris    coderanch.com

Hi, We are using java drag and drop feature in solaris. In windows its working fine. When we try to run the same program in solaris its not working. We are using JDK1.3.1 in solaris. The error I'm getting when I execute the java drag and drop program in solaris is as follows: Exception occurred during event dispatching: The operation requested ...

27. Drag and Drop JDK1.4.0    coderanch.com

Hi all, I have just downloaded JDK1.4.0 and I would like to be able to create a Jlist of components from which I could drag items to a JTextfield. Has anyone done this or can it be done?? I have seen example on the sun website but it says these will become obsolete in v1.4.0. Has anyone got any information on ...

28. Drag and drop    coderanch.com

29. Sample program for Drag & Drop    coderanch.com

30. Drag and Drop    coderanch.com

31. Drag and dropping the swing components    coderanch.com

32. Drag and Drop in jdk1.4    coderanch.com

Hai guyz, I want to tranfer an image icon from one lable to another label that is I want the behaviour of Cut and Paste of image but the mouse released event is not working properly or may be some problem in my Transfer Handler ,I will really appreciate if some one solve my problem ..or can give me code for ...

33. Drag and Drop    coderanch.com

34. Drag and Drop Problem    coderanch.com

What component is listening for the drop? The tree, scrollpane, or panel? Coordinate space may be different in all of them. If another component is listening to the drag and drop, it gets points in its coordinates. You would have to convert the point into the coordinates of the tree if you want to find out where on the tree the ...

35. Drag and Drop in Swing (J2SE 1.4)    coderanch.com

36. Drag and Drop    coderanch.com

37. drag and drop    coderanch.com

38. Drag n Drop    coderanch.com

Hi, Here's some code for drag n drop and cut and paste: package test.swing; import uk.co.aps.swing.SwingWorker; import java.awt.*; import java.awt.datatransfer.*; import java.awt.dnd.*; import java.awt.event.*; import javax.swing.*; public class Progress extends JPanel { private BorderLayout borderLayout1 = new BorderLayout(); private static JProgressBar bar = new JProgressBar(); private JButton btn = new JButton(); private final void pasteIt() { final SwingWorker worker = new ...

39. Drag N Drop...    coderanch.com

40. problem with Drag and Drop    coderanch.com

41. Problems with Drag and Drop    coderanch.com

Hi All, I am writing an app where I am using Drag & Drop. When I am dragging a tree node, the path is shown like this. "Dragging from tree path = [Data, Geographic, US States]" "Parent path = USA" When I drop the tree node on some other node, this is happening. "Removing the tree node" "Dropping from tree path ...

42. implement drag drop.    coderanch.com

I m using Jdk1.3.1. I want to implement drag and drop within a JList. My list displays images and i need to drag an image from a particular location and drop it at some other location in the same list. Each element of the list is a Jpanel which contains a Jlabel that displays the image. I m able to make ...

43. Need Help on Drag and Drop...    coderanch.com

44. problems with drag and drop    coderanch.com

Hello, I am having problems with the drag and drop aspects of my project. Initially the drag and drop properities worked correctly, and the mouse changed correctly. In order to enhance the usability of the rest of my project i decided to change the mouse to a WAIT_CURSOR when the event takes more than 300 miliseconds. This aspect also works correctly, ...

45. Drag and Drop - is this possible in Swing ?    coderanch.com

Thanks for reading - I would appreciate some advice from the gurus !! We want to provide a user interface that allows users to drag objects onto an image and drop them there. We need to be able to track the position of the dragged images, so that we can redisplay the resulting map later, so that the user can change ...

46. Drag and drop in java    coderanch.com

47. Drag n Drop -Help!!!    coderanch.com

48. Drag and drop    coderanch.com

49. Java Drag and Drop    coderanch.com

Is the Java Drag and Drop feature available only for Swing components? Here's what I'd like to do: I am using a 3rd party charting software in which a chart (which is a Swing Component) has x and y axes that belong to a class that extends directly from java.lang.Object. Initially, when my application is run, there would be 2 waveforms ...

50. Drag and Drop    coderanch.com

I wish to select and drag text from a JTextField (or any text-like component will do for now) to any other application outside of the VM as if it were a cut or copy operation. I have had no success playing with TransferHandler, but a quick search of this forum suggests no simple solution. However, I know of one application (Intellij ...

51. drag & drop with swing    coderanch.com

52. Drag and drop gui    coderanch.com

Hi. I have just little experience with swing. Right now, I just to build a simple app that will display some data to the user. However, I don't know which gui/plugin/ide i should use. I want something with drag and drop components (delphi/jbuilder style) which is free. So, what are my best choices with ides/guis/pluings, etc...? Thanks.

53. InvalidDnDOperationException: Drag and drop in progress    coderanch.com

Hey! I had a problem with these InvalidDnDExceptions too. Not in an applet, but in an application on Win32. I didn't find neither the reason why nor the excact action producing that action. It just sometimes happened. Afterwards, DnD stopped working. My ugly workaround is to put a try-catch-block around the startDrag-call. Now, it seems to work fine. Might work for ...

54. drag and drop    coderanch.com

55. Dragging and dropping pictures    coderanch.com

56. Drag and Drop problem    coderanch.com

Hello All, I'm trying to implement DnD in a JTree I have a problem when the user drags a node to a place it's not allowed to be dropped The action doesn't seem to be ended properly here's example code for discussion http://www.java2s.com/Code/Java/Swing-JFC/DnDdraganddropJTreecode.htm So, there's a drag source and a drop target when you begin the drag the function dragGestureRecognized in ...

57. Drag and Drop Application    coderanch.com

Can you provide a link to what you want with "drag and drop"? I did a search for "eclipse drag and drop" and found a document that talks about an SWT version of the AWT version of drag and drop discussed in the previous link... all data transfer related stuff... Components *are* data - moving them between applications *is* data transfer. ...

58. Facing with Drag and Drop issues    coderanch.com

59. Drag and Drop    coderanch.com

Hi my name is Casey, I'm currently taking AP Computer Science at my high school and I am working on a project that is worth quite a bit of my grade. My group leader decided that we would create a virtual closet. We've got most of the work done except for 1 part. I can't figure out how to use drag ...

60. Table & Drag,Drop    coderanch.com

Hi Guys, I have 2 questions running around my head,which I would like to clear. [1]I have a table(say 4 columns).It would be populated with datas on loading. After this Initial loading of the table, may have to add new rows,delete rows,move rows up & down. I have my own tablemodel as below, extending from AbstractTableModel. ///MyTableModel extends AbstractTableModel Have seen ...

61. Drag and drop?    coderanch.com

62. Drag and Drop in web applications    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

64. Drag And Drop    coderanch.com

65. Drag and drop problem    coderanch.com

Hello guys! This is my first post on this forum I am a beginner to java! What i want to do is make a drag and drop from a jtree and a JList. The Jtree contains the all file system and want to drop only drop the filename with path to the JList. I found an example of FileTree which uses ...

66. yFiles: drag and drop    coderanch.com

67. Drag and Drop Swing    coderanch.com

68. java drag & drop?    coderanch.com

69. Learning to use Drag and Drop    coderanch.com

Olivier Legat wrote:I'm trying to place a "draggable" Component inside a Panel. What I mean by that is I want to be able to have something like a JLabel for example that can moved around the Panel from one position to another With JPanel(null) and using label.setLocation(..), we can drag any JLabel having a MouseMotionListener and a MouseListener. As an example, ...

70. Drag & Drop problem    coderanch.com

Hi. I have a question on DnD. the code first: package test; import java.awt.Dimension; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.io.File; import java.util.List; import javax.swing.DropMode; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.TransferHandler; public class DnDTest { public static void main(String[] args) { JFrame frame = new JFrame("DnD Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); JList list = new JList(); list.setDragEnabled(true); list.setDropMode(DropMode.ON); list.setTransferHandler(new TestTransferHandler()); ...

71. Exception while implementing drag n drop in java 1.6    coderanch.com

java.lang.NullPointerException at javax.swing.plaf.basic.BasicTreeUI.getDropLineRect(Unknown Source) at javax.swing.plaf.basic.BasicTreeUI.access$1600(Unknown Source) at javax.swing.plaf.basic.BasicTreeUI$Handler.repaintDropLocation(Unknow n Source) at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(Unknown Sou rce) at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) at java.awt.Component.firePropertyChange(Unknown Source) at javax.swing.JTree.setDropLocation(Unknown Source) at javax.swing.TransferHandler$DropHandler.setComponentDropLocation(Unkn own Source) at javax.swing.TransferHandler$DropHandler.cleanup(Unknown Source) at javax.swing.TransferHandler$DropHandler.drop(Unknown Source) at java.awt.dnd.DropTarget.drop(Unknown Source) at javax.swing.TransferHandler$SwingDropTarget.drop(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Sourc e) at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEven t(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Un known Source) at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) ...

72. drag and drop component based gui    coderanch.com

73. How to create resizable swing components as in Netbeans Swings (GUI), drag and drop?    coderanch.com

thanks for the reply....... iam facing the following problems... 1.Unable to get the scrollbar when the component is created at the borders of the panel........but, upon dragging the component scrollbar is displayed. 2.How to display scrollbar, when components are moved towards South and West directions? (or) how to stop moving the components, when they reaches South and West borders? Note: Succeeded ...

74. Can anyone help me with Drag and Drop in swing?    coderanch.com

I'm trying to figure out how to enable drag and drop of JButtons between different JPanels. Basically I have a bunch of JButtons on screen whose only purpose is to display nice looking rectangles. I need to be able to drag any of the JButtons and drop them on a different JPanels. From what I gather about DnD in swing I ...

75. Help please with drag and drop    coderanch.com

Hello everyone, I apologize if I am not making things the right way, although I registered a long time ago this is my first post at this forum. I have a little problem here, it work almost perfect except that when I drag from bottom to top it does not do it. I put print lines and it says that it ...

76. really confused about Data Flavors used for drag and drop    coderanch.com

I have a Transfer Hander as follows: class FileDropHandler extends TransferHandler { @Override public boolean canImport(TransferSupport supp) { /* for the demo, we'll only support drops (not clipboard paste) */ ConsoleOutput("We are in FileDropHandler"); // ConsoleOutput("this is a test"); if (!supp.isDrop()) { ConsoleOutput("It is not a drop"); return false; } /* return true if and only if the drop contains a ...

77. Problem with drag and drop location    coderanch.com

I am trying to master drag and drop by putting together various code snippets from various google sources. It's almost working as intended apart from an annoying problem locating the dropped item on a target panel. The code around lines 80-90 deals with the placement of the dropped panel object. The issue seems to be that unless the user drags the ...

78. Preventing multiple drag and drop    coderanch.com

Hi, I am writing a drop zone application where I will load the information of the file dropped in. The information will be extracted from the file and stored across the network so there will be a couple of seconds between each drop. What I want is to disable the drop zone and show a message "Sending..." during that period of ...

79. Drag and Drop cannot access inside content    coderanch.com

Hi everyone, I have a request in my project to implement draggable panels that contain buttons inside. I have followed the guidelines from the official tutorial ( http://download.oracle.com/javase/tutorial/uiswing/dnd/index.html ). The panel definition extends JPanel and implements the Transferable interface. The panels are contained in a JList that has the draggable functionality enabled, and custom cell renderer and transfer handler attached. The ...

80. Drag and drop line JComponent1 - > JComponent2    coderanch.com

Hy . I am building a graphical drawing tool (for Unified Modeling Language and related stuff) but i am stuck and i would really appreciate any help regarding this issue. Each of my components drawn on canvas have attached a panel with a button on it. The desired behavior is , i press the button , and keeping the mouse pressed ...

81. Drag and Drop problem    coderanch.com

here is some classes: AbstractDropManager.java package test; import java.awt.Point; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.SwingUtilities; public class AbstractDropManager implements DropListener { protected JComponent component; public AbstractDropManager() { this(null); } public AbstractDropManager(JComponent component) { this.component = component; } protected Point getTranslatedPoint(Point point) { Point p = (Point) point.clone(); SwingUtilities.convertPointFromScreen(p, component); return p; } protected boolean isInTarget(Point point) { Rectangle bounds = component.getBounds(); ...

82. Drag and drop    java-forums.org

Hello there, I am currently working on developing a module to compute the fault tree probability. I'm planning to use the Java AWT and Swing class to develop a J-Frame or container containing the drag and drop images (AND and OR gate symbols). The images are expected to be drawn(dragged and dropped) at another container. Upon completion the software should compute ...

83. Drag and Drop(URGENT)    java-forums.org

Hi, I am implementing drag and drop on jtables.Dragging jtable1 rows and dropping to jtable2 and vice-versa.I am facing following issues. --I need to make a check that when a row from jtable1 is dropped the operation is performed only if the drop place is jtable2 and vice-versa. -- I am able to do multiple selections but when i drag them ...

84. Drag & Drop, invalidDnDException, totally urgent.    java-forums.org

Hey there folks, I'm working on a GUI Checkers project for college... everything works flawlessly on windows, but fails to do so on Linux (latest Ubuntu). When debugging with Netbeans, the following comes up: Java Code: Exception in thread "AWT-EventQueue-0" java.awt.dnd.InvalidDnDOperationException: Cannot find top-level for the drag source component at sun.awt.X11.XDragSourceContextPeer.startDrag(XDragSourceContextPeer.java:111) at sun.awt.dnd.SunDragSourceContextPeer.startDrag(SunDragSourceContextPeer.java:111) at java.awt.dnd.DragSource.startDrag(DragSource.java:306) at java.awt.dnd.DragSource.startDrag(DragSource.java:376) at checkers.GUICheckers.GUIStone$DragGestureRecognizer.dragGestureRecognized(GUIStone.java:49) I can't ...

85. Java 2d Graphics Drag and Drop    java-forums.org

Java 2d Graphics Drag and Drop Hi, I am trying to do some drag and drop with graphics. I have several rectangles that I want people to be able to click on, and drag over to a grid. If the cursor is in the grid, then I want a copy of the graphic to "snap" to one of the ...

86. Developing Drag and drop Analog Clock    java-forums.org

Developing Drag and drop Analog Clock I have already code for analog clock. Class Clock is extended Jpanel.I have used Jpanel as parent Panel. In Which i placed this Analacolck in coding.i get the clock. but i am unable to change the background color. kindly give solution [Code] /* * To change this template, choose Tools | Templates * ...

87. drag and drop - disable intra component drop    java-forums.org

Hi guys, I have two JFileChoosers to which I've attached custom TransferHandlers. I'd like to allow the user to drag from one file chooser to the other, but not from one chooser to itself. I can't find anywhere in the api to find the source of a drag, so I'm not sure that this can be done. I can disallow drops ...

88. drag and drop for diagrams - help!    java-forums.org

hi again,, I managed to do the drag & drop but the problem is components are moved, I want them to be copied here's the code.. Java Code: import javax.swing.*; import java.awt.dnd.DnDConstants; // drag and drop actions import java.awt.*; import java.awt.datatransfer.*; //for use with the clipboard import java.awt.dnd.*; //To develop the D&D metaphor import java.awt.dnd.DropTarget; // to associate destenation of data ...

89. Creating a Drag and Drop    java-forums.org

Hi, I am currently working on a project and is new here. Any advice where i could start working on a sample below with visual editor? derivative underlying Futures options single-stock futures stock index long short Stock index futures A stock _________ is any financial instrument which has a value that is dependent on the price of the _________ stock. ________ ...

90. drag and drop    java-forums.org

Hey, I need some help here, when i compile and ran the codes below, i was able to drag and snap the image onto the top left hand corner of the panel. However, when i move the image away and clicked onto the corner, the image gets repainted over there, how do i prevent this from happening? Would greatly appreciate some ...

91. Drag and Drop problem...    java-forums.org

Here is my code: AbstractDropManager.java Java Code: import java.awt.Point; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.SwingUtilities; public abstract class AbstractDropManager implements DropListener { protected JComponent component; public AbstractDropManager() { this(null); } public AbstractDropManager(JComponent component) { this.component = component; } protected Point getTranslatedPoint(Point point) { Point p = (Point) point.clone(); SwingUtilities.convertPointFromScreen(p, component); return p; } protected boolean isInTarget(Point point) { Rectangle bounds = ...

93. netbean's drag and drop GUI builder    java-forums.org