🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9772

Re: Message box from drag and drop

#9772
From: Tad Frysinger
Date: Tue, 25 Jan 2000 00:00
55 lines
2443 bytes
I have seen this from time to time when the component owner of the dialog is not
a Frame descendent.  Can you use 'new Frame()' instead of 'this' just to see if
it makes any difference?

Tad Frysinger (TeamB)

"Mikhail M.Mizels" wrote:

> Hello All!
>
> I have following problem: I implement Drag and Drop in my program and I need
> to show message box when drop occured, but when I call
> JOptionPane.showMessageDialog() my program hangs.
>
> This is an example which I have downloaded from java.sun.com
>
>   public void drop (DropTargetDropEvent event) {
>
>     try {
>         Transferable transferable = event.getTransferable();
>
>         // we accept only Strings
>         if (transferable.isDataFlavorSupported (DataFlavor.stringFlavor)){
>
>             event.acceptDrop(DnDConstants.ACTION_MOVE);
>             String s = (String)transferable.getTransferData
>  DataFlavor.stringFlavor);
>             addElement( s );
>             event.getDropTargetContext().dropComplete(true);
>
> // THIS IS MY CODE INSERTION
>             JOptionPane.showMessageDialog(this, "test", "test",
> JOptionPane.INFORMATION_MESSAGE);
> // THIS  IS END OF MY CODE INSERTION
>         }
>         else{
>             event.rejectDrop();
>         }
>     }
>     catch (IOException exception) {
>         exception.printStackTrace();
>         System.err.println( "Exception" + exception.getMessage());
>         event.rejectDrop();
>     }
>     catch (UnsupportedFlavorException ufException ) {
>       ufException.printStackTrace();
>       System.err.println( "Exception" + ufException.getMessage());
>       event.rejectDrop();
>     }
>   }
>
> This also hangs.
>
> I  tried to use SwingUtilities.invokeLater() to show message but it has the
> same effect.  What am I doing wrong?
Technical Details
Message-ID: <388D9DE4.698B2044@earthlink.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <855rd2$s2t21@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,4b45373640cb09ef
X-Google-Attributes: gid111d45,public
From: Tad Frysinger <tfrysinger@earthlink.net>
Subject: Re: Message box from drag and drop
Date: 2000/01/25
Message-ID: <388D9DE4.698B2044@earthlink.net>
X-Deja-AN: 577367960
Content-Transfer-Encoding: 7bit
References: <855rd2$s2t21@bornews.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Reply-To: tfrysinger@earthlink.net
Newsgroups: borland.public.jbuilder.java.swing