Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2007

Tip: Looking for answers? Try searching our database.

Swing drag & drop examples in Java 6.0?

Thread view: 
Qu0ll - 20 Jul 2007 12:39 GMT
I have never implemented drag & drop in Swing and now I need to do so in a
Java 6.0 JTree.  To get me started I would be very grateful if someone could
point me to or even post a simple example of this usage even if it's not in
actually involving a JTree.  I have googled and found a few helpful articles
by Shannon Hickey but the source used in them doesn't seem to be readily
available.  I can find a few examples in Java 1.4 and earlier but I know
there have been significant changes in 6.0 and I would rather not confuse
myself with superseded coding methods.

Can anyone help me?

Signature

And loving it,

-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)

Andrew Thompson - 20 Jul 2007 14:41 GMT
...
>Can anyone help me?

Can you help you?  AKA How's your Google-fu?

Work your way back from these demos..
<http://www.google.com/search?q=drag+site%3Ajava.sun.com+filetype%3Ajnlp>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Nigel Wade - 20 Jul 2007 15:02 GMT
> I have never implemented drag & drop in Swing and now I need to do so in a
> Java 6.0 JTree.  To get me started I would be very grateful if someone could
[quoted text clipped - 6 lines]
>
> Can anyone help me?

http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html

I did at one point implement D'n'D for some components using this Tutorial as
the basis for the work. I got the basic functionality to operate, but then
decided on a better way of doing things so never completed it.

It should be enough to get you started. It should also give you the terminology
to help you Google for more specific information.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Qu0ll - 20 Jul 2007 15:30 GMT
> http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html
>
[quoted text clipped - 6 lines]
> terminology
> to help you Google for more specific information.

Thanks Nigel, that looks good.  But I am unable to run the extended D&D demo
as I encounter this error in JNLP:

java.io.FileNotFoundException:
http://java.sun.com/docs/books/tutorialJWS/uiswing/dnd/ex6/ExtendedDndDemo.jnlp
at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException:
http://java.sun.com/docs/books/tutorialJWS/uiswing/dnd/ex6/ExtendedDndDemo.jnlp
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
... 16 more

Could you possibly verify that this is something at the Sun end of things
and not my configuration by trying to run it yourself?  I am using Java 6
Update 2.  The first demo runs fine.

Signature

And loving it,

-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)

Nigel Wade - 23 Jul 2007 09:32 GMT
>> http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html
>>
[quoted text clipped - 11 lines]
>
> java.io.FileNotFoundException:

http://java.sun.com/docs/books/tutorialJWS/uiswing/dnd/ex6/ExtendedDndDemo.jnlp
>  at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source)
>  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)

> Could you possibly verify that this is something at the Sun end of things
> and not my configuration by trying to run it yourself?  I am using Java 6
> Update 2.  The first demo runs fine.

Yes, I get the same error. It looks like the file is missing on the server. When
I did this the tutorial was setup for Java 1.4, and then the demos were source
only, there weren't the JNLP links. It seems not everything has been updated
correctly.

The source for the demos can be downloaded. If you scroll to the bottom of the
page there are links to the source code so you ought to be able to download it
and run it locally.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.