DnD in Applet...

I have a problem very similar to some postings that I have read here. I have a JTree and a JTable with DnD functionality in an applet. As everyone has heard before, I can pick up an item from the tree and drag it over to the table, but the drop does not occur. It works fine in application form but when we converted to an applet, to drop does not happen. Just like all the other developers' postings, it is the DropTargetListener that is not responding to events, the DragSourceListener is fine.
To add to my senario, I can ultimately get the drop to occur through an event in my code. I have a menu called "view" that allows the user to select the UI style they want (metal, motif, windows). If I select one of these options (it does not matter which one I select), and then attempt to drag and drop an item, it succeeds.
I have seen various solutions to the problem like implementing serializable, not implementing DnD until the applet is up in the browser, and placing the code within a thread. However, I thought that it would be worth posting the situation that I have with the UIManager (Look and Feel) code. My thought is that the suggestion of "not implementing DnD until the applet is up" is most applicable to my situation b/c it is not until the applet is up and running that I go to the view menu and change the Look and Feel.
Any thoughts?

I just moved from NT to 2000. Now I can perform the drop.

Similar Messages

  • DnD + Applet + Mozilla doesn't work on Linux

    hello!
    I have a Java Applet which use DnD.
    When i run it in Internet Explorer it runs fine....
    But when i try it in Mozilla (Linux), the DnD refuse to work... :(
    Help anyone???

    more info:
    OS: RedHat LInux ver. 9.0
    WM: Gnome 2.2.0
    Mozilla: 1.7.2
    java version 1.4.1 blackdown-linux
    the exception we (sometimes) get when trying to drag is "InvalidDnDOperationException: Drag and Drop in progress" (once again, the same code works perfectly in windows).

  • Applet not opening in browser  Help needed

    Hi experts,
    I have Java installed in my machine in the path C:\Program Files\Java
    While trying to open the link http://www.radinks.com/upload/applet.php in browser, I am being asked to install the missing plugin and that plugin is java.
    I do not know why this happens and I am stuck with this problem for sometime.
    Any help in this regard will be well appreciated with dukes.
    Thanks in advance,
    Kind Regards,
    Anees

    faheemhameed wrote:
    I have the same issue. But this is on Internet Explorer 8. Firefox is fine.Given the [web page does not validate|http://validator.w3.org/check?uri=http%3A%2F%2Fwww.radinks.com%2Fupload%2Fapplet.php&charset=(detect+automatically)&doctype=Inline&group=0] *(<- link),* I am not surprised it fails in some browsers while working in others. Checking the source of the page itself, I notice the applet is embedded in the page using an OBJECT element only, and that possibly also explains why it works in some browsers but not others.
    The best bet of the author of the web page is to defer writing the applet element to the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] *(<- link)* that is provided by Sun.
    Unfortunately there is little that you can do about it, unless you want to attempt creating a page to load off your hard disk, that is valid and workable for IE. I cannot guarantee it will work, but try this variant..
    The altered web page, which can be tested at [http://pscode.org/test/radinks/applet.html].
    <html>
    <body>
    <applet
      code="com.radinks.dnd.DNDAppletPlus"
      archive="dndplus.jar"
      codebase="http://www.radinks.com/upload/"
      width= "290"
      height= "290"
      alt="Java is recognised, but disabled!">
        <param name="url" value = "http://67.131.250.110/upload.php">
        <param name="message" value="http://www.radinks.com/upload/init.html">
        <param name="name" value="Rad Upload Plus">
        <param name="max_upload" value="10000">
        <param name="encode_path" value="yes">
        <param name="translate_path" value="yes">
        <param name="full_path" value="yes">
    This browser does not recognise the Java APPLET element.  Get Java from www.java.com.
    </applet>
    </body>
    </html>

  • AccessControlException in Applet Running 1.6.0_19

    Under JRE 1.6.0_19, my applet now gets an AccessControlException when trying to do a drag-and-drop operation between windows (running in the same applet). It worked OK under _18. Can anyone point me to some documentation on what changed here? I didn't see anything about it in the release notes.

    tomangioletti wrote:
    Under JRE 1.6.0_19, my applet now gets an AccessControlException when trying to do a drag-and-drop operation between windows (running in the same applet). It worked OK under _18. Can anyone point me to some documentation on what changed here? I didn't see anything about it in the release notes.For changes the affect OpenJDK 6, more information can be found through the updates that goes into that. For instance:
    "(CVE-2010-0091): Unsigned applet can retrieve the dragged information before drop action occurs (6887703)."
    http://ubuntuupdates.org/packages/show/154565
    Obviously, an unsigned applet should allow a drag-and-drop within itself, even if system dnd is (partially) available. So there's probably something worth looking into here.

  • Help with compiling applet

    I'm new to java and have a pronlem.
    I've downloaded an open-source piece of code in a jar file - filedrop - which exists in the namespace net.iharder.dnd* and my own code exists in the namespace sm.aaron.fileupload*, and requires the code from filedrop. I'd like to be able to compile an applet with the dependencies intact - however, I keep getting classdefnotfound exceptions on compile. I've included the jar file for filedrop in my classpath - what am I doing wrong? If I break the jar file out into classes and try to compile, it generates classdefnotfound for each class in filedrop as well. Basically I'm trying to build an applet that uploads files from a drag and drop operation.

    Source is available at http://www.silicongraffiti.com/src.zip
    I'm trying to use javac --classpath ./filedrop.jar ./pathtosrc/ to create the applet... the weird thing is, this works in netbeans, but I have no idea how to make it work outside of netbeans.  And netbeans doesn't have a decent way to set up an applet embedded in an html page, and even if it did I can't move the files from netbeans or they cease to function.  Gr.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Does JTree support multiple DnD?

    I'm working on an applet which displays a JTree tree, which has to support multiple DnD.
    i mean, user has to be capable of selecting several nodes at a time and drag all of them, dropping them into a target.
    Though i have asked about it, and somebody told me about it, the solution was with a JFrame, and all the examples which work and i've read, arre with JFrame.
    So i guess that maybe JTree does not support multiple DnD, and moreover, there is a website
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4165577
    in which someone says that, in fact, JTree does not support it. But it's and old page, so i want to know if at present, Jtree still has this debug.
    Thanks in advance!

    http://www.java-forum.org/de/viewtopic.php?p=139820#139820

  • Drag n Drop in Applets

    Is the java.awd.dnd package available to Applets? I would like to build an applet with drag & drop functionality.

    Dragon Droppings?
    Hmmm...I don't see why not, but there's only one way to find out.
    Try it!

  • Drag-n-drop in applet....

    Hi everybody!
    I really hope someone might be able to help me with this!! I have an applet with a GUI. In the GUI I have a JTree and a "working area" (JPanel). I want the user to be able to select a component in the tree and drag it onto the area. When the user lets go, the object appears in the area as a (draggable) UML object.
    The problem is the drag-n-drop part. How do I do this?!?! I have to keep the JTree and JPanel in the same object container, right? I've tried making functions for dragging the UML object around inside the working area, no problems. But when I try to drag something between an area and a tree, nothing works. Do I have to have a specific panel in which I include both the JTree and the working area, or? Does anyone know how this might be solved, or have you seen any example of this?!?!
    Very grateful for help!
    / jezzee

    hey jezee,
    i am also trying to do the same thing, only my drag and drop can also be from the work area to the JTree. I am still trying to understand the process. I have implemented DnD in just the JTree.
    Can you send me the part of your code which involves the drag and drop, just to get an idea. Did you finally get an answer to your question? if so, can you please share the solution with me. i would really appreciate that. I will do so too, as soon as i find the correct way to implement it.
    You can email me at [email protected]
    Thanks very much,
    sk.

  • Applet path

    i have .html file like this
    <html><head><title> Jbutton demo program</title></head>
    <body>
    <applet code ="Test2.class" CODEBASE="WEB-INF\classes\com\fujitsu\pd\ctl\tsarr010" width =600 height =500 name = a2>
    </applet></body>
    my java class as follows
    package com.fujitsu.pd.ctl.tsarr010;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.datatransfer.*;
    import java.io.*;
    import java.awt.dnd.*;
    public class Test2 extends JApplet implements ActionListener{
         private static final long serialVersionUID = 1L;
         DropLabel dropLabel=null;
         Container c=null;
    public void init(){
              c = getContentPane();
    c.setLayout( new GridLayout(6,5,2,2));
    for(int i=1;i<=25;i++){
    dropLabel =new DropLabel("X",DnDConstants.ACTION_COPY_OR_MOVE);//ACTION_COPY
    dropLabel.setName("X");
    dropLabel.setBackground(Color.yellow);
    dropLabel.setOpaque(true);
    //dropLabel.setIcon(ii);
    c.add(dropLabel);
    JButton jb=new JButton("Register");
    c.add(jb);
    jb.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    please u see package of above class
    these packges are in WEB-INF\classes folder.
    how can i give the path of the class file in CODEBASE in .html file.
    if i give loke that it is not loading.
    how to combine these packeges with directory.
    if i give
    WEB-INF\classes\com.fujitsu.pd.ctl.tsarr010
    also not working
    my .html file in another directory like this
    fbicext/jsp/tsarr010/.html
    fbicext/WEB-INF\classes\com.fujitsu.pd.ctl.tsarr010.Test2.class
    please tell me how to load this applet,it is in tomcat web-app directory

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=650503

  • Why this tree can not show on the Applet?

    hi, all, I try to create a java Applet show a tree, this following code has no error, but the tree can not show on the Applet, can any one tell me why? thanks!
    <code>
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.dnd.*;
    public class AppletApp extends Applet {
         Date myDate;
         protected JTree m_tree = null;
         protected DefaultTreeModel m_model = null;
         protected JTextField m_display;
         public void init() {
         public void paint(Graphics g) {
              DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");          
              DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("node1");          
              root.add(node1);                    
              node1.add(new DefaultMutableTreeNode("sub1_1"));                         
              node1.add(new DefaultMutableTreeNode("sub1_2"));                                        
         public static void main(String arg[]) {
              JFrame myFrame = new JFrame();          
              Container contentPane = myFrame.getContentPane();
              contentPane.setLayout(new GridLayout(1,2));          
              AppletApp app = new AppletApp();          
              contentPane.add(new JScrollPane(app), BorderLayout.CENTER);     
              myFrame.addWindowListener (new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              app.init();
              app.start();
              myFrame.setSize (400,400);                              
              myFrame.setVisible(true);          
    </code>

    Not quite sure what you are trying to do, but if you move the code from the paint() method into the init() method (then delete your paint() method), then add one new line to the init() method (after the code you just inserted) that reads:
    getContentPane().add(new JTree(root));
    - You should at least see a tree!

  • DND on Linux in Mozilla Firefox

    Hello!
    Maybe someone can explain me the following problem:
    I have applet on my page. I use Drag 'n Drop to drop images from windows explorer to this applet. But it doesn't works on Linux, in Java Console I have following messages when trying to drop some image from Konqueror:
    Exception in thread "AWT-EventQueue-2" java.awt.dnd.InvalidDnDOperationException: invalid rejectDrop()
    at sun.awt.dnd.SunDropTargetContextPeer.rejectDrop(Unknown Source)
    at java.awt.dnd.DropTargetContext.rejectDrop(Unknown Source)
    at java.awt.dnd.DropTargetDropEvent.rejectDrop(Unknown Source)
    at com.aurigma.imageuploader.windows.h.drop(Unknown Source)
    at java.awt.dnd.DropTarget.drop(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer.access$800(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source)
    at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    Of course, my applet is signed, I wrote that all works on Windows and Mac......

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Open web pages from an applet

    I'm developing an applet that has to open some web pages.
    The only way I know is to use the method showDocument that
    needs and URL. So, how to pass parameters to the web page?
    I don't want to put them in the URL: everyone can see
    "secret data"!
    Help me, please.

    Take a look at this example that uses a JEditor pane to hold the HTML page.
    //Create a new JEditor Pane
    jep = new JEditorPane( );
    //Ensure the pane is not editable
    jep.setEditable(false);  
    //Use this to get local HTML file
    URL fileURL = this.getClass().getResource("Manual/Manual.htm");
    //add the html page to the JEditorPane
    jep.setPage(fileURL);Ok the core line of code here is this.
    URL fileURL = this.getClass().getResource("Manual/Manual.htm");The standard method for accessing a html file via a URL is thus. As you can see its very similar.
    URL fileURL = new URL("http://www.comp.glam.ac.uk/pages/staff/asscott/progranimate/docs/Manual/Manual.htm");this.getClass().getResourse() will return the file location of the class you are working with.
    By doing the following you can access manual.html in a folder called Manual that sits in the same file location as the class file you are using.
    URL fileURL = this.getClass().getResource("Manual/Manual.htm");I hope this helps.
    Andrew.

  • Unable to load database driver from my applet's jar file

    I'm trying to set up an applet that will talk to a MySQL database. I have no problem connecting to the database as I'm developing the code ("un-jarred"), but when I create a jar file of my code to test through a web browser, I cannot connect to the database due to the usual ClassNotFoundException. I have included mysql-connector-java-3.1.12-bin.jar (the current driver) in the jar, but I don't know if I'm supposed to supply some info through an attribute to the applet tag to let it know that the jar contains the driver it needs or if I have to call the driver differently in my code.
    Any help is appreciated, thanks.

    The simplest approach is always the best. :)Abso-lutely.
    Awesome, that worked perfectly. I Included the extra
    jar file in the applet tag and now my applet makes
    some sweet lovin' to the database.And you have succeeded where thousands have failed. Congratulations.

  • Applet java file not refreshing in browser

    I have an applet that I am updating and I am not seeing the corresponding update when I open the web page. I can manually download the java class file and look inside it and it definitely is the updated file. I have deleted the browser history. (I am running tests with Firefox 3, IE7, and Safari 4 public beta). Is there something else I need to do to make sure the browser pulls in the latest version of the class file referenced in the html?
    Here is the code:
    <HTML>
    <HEAD>
       <TITLE>A Simple Program</TITLE>
    </HEAD>
    <BODY>
       <CENTER>
          <APPLET CODE="SendRequest.class" WIDTH="500" HEIGHT="150">
          </APPLET>
       </CENTER>
    </BODY>
    </HTML>The applet refers to a hard coded URL to read through a urlconnection. It is always reading a file and showing content, but it is not showing the right file. If I change the name of the referenced file in the java program, it looks like the browser has cached the referred file, rather than throwing and error and saying the file doesn't exist.
    Here is the java
    import java.applet.*;
    import java.awt.*;
    import java.net.URLConnection;
    import java.net.URL;
    import org.w3c.dom.Document;
    import java.lang.String;
    import java.io.*;
    public class SendRequest extends Applet {
        @Override
        public void paint(Graphics g) {
            g.drawRect(0, 0, 499, 149);
            g.drawString(getResponseText(), 5, 70);
        public String getResponseText() {
            try {
                URL url = new URL("http://myserver.com/stats/logs/ex20090603000001-72.167.131.217.log");
                URLConnection urlconn = url.openConnection();
                BufferedReader in = new BufferedReader(
                                    new InputStreamReader(
                                    urlconn.getInputStream()));
                String inputLine;
                String htmlFile = "";
                try {
                    while ((inputLine = in.readLine()) != null)
                        htmlFile += inputLine;
                    in.close();
                    return htmlFile;
                } catch (Exception e) {
                    return "Can't get the string.";
            } catch (Exception e) {
                return "Problem accessing the response text.";
    }Any help would be appreciated. I heard that some files may cache more persistently than others, but I don't fully understand the details.
    Thanks,
    Jim

    Check this [document loader example|http://pscode.org/test/docload/] & follow the link to sandbox.html for tips on clearing the class cache. That relates specifically to caching a refused security certificate, but class caching is much the same. As an aside, getting a console can be tricky in modern times (unless the applet fails completely). It is handy to configure the [Java Control Panel|http://java.sun.com/docs/books/tutorial/information/player.jnlp] to pop the Java console on finding an applet (Advanced tab - Settings/Java Console/Show Console).
    Of course there are two better tools for testing applets, especially in regard to class caching. AppletViewer and Appleteer both make class refresh fairly easy. Appleteer is the better of the two. I can tell you that with confidence, since I wrote it. ;-)

Maybe you are looking for

  • Paper tray hp laserjet 1018

    It should be simple.  I cannot close the paper tray of my HP LaserJet 1018 printer.   It is hinged and when I lift it, it moves about 30 degrees and stops.  I am afraid that if I force it any farther something will break.  How does it close?  It was

  • Software crashes due to the missing fonts

    I am using this translator software(有道词典) for a few years. But it starts crushing every time when I try to open it, and it won't let me open. The same problem happened last year, and problem was solved when I went to apple store. I was told that this

  • How to stop and start IGS(internet graphic server)

    Hi Techies How to stop and start IGS(internet graphic server) in Solaries IGS is 7.0 1patch Is this the command to stop and start IGS stopigs and startigs If this correct will there be any issues if i stop the IGS from the above command Thank You Har

  • OBI EE clone

    Hello, Do you know what would be the necessary steps to "clone" a full OBI EE installation to another server ? Is there any documented steps to do that ?

  • I can not pause music in control center after ios7.01

    This just started after the ios 7.01. Is it a software issue? Apple get on this please.