New NetBeans Drag And Drop Samples

In Drag and Drop from Component Palette to Multiview Editor, I discussed a sample that, at the time, was in my update center but that I've since somehow managed to delete. I found it again and modified it slightly (not the code, just the external texts):

So, here you can take any word from the palette and drop it on any word in the window. When you do this, the word from the palette replaces the word in the window. You can also take any word in the window and drag it to the palette, within one of the existing categories.

And today I received a new sample (from Stan Aubrecht, the same NetBeans engineer who developed the sample above) which will probably form the basis of a new tutorial. Here's what it looks like:

You can drag a Simpsons character from the palette and drop it in the window. Then you can drag the character again, within the window. This is the same concept as the one shown in the "Organigram Generator" and elsewhere in recent discussions in this blog.

If you're new to all of this drag and drop (or, as drag-and-droppers in the know call it, "DnD") stuff, here's a great spot in the Java tutorial where you can get started learning all the terminology. Ask yourself, for example, if you know what a "transferable" is. And a "TransferHandler". And a "DataFlavor". If you answered "Dunno, man, and you're stressing me out with these questions" to any of these terms (or frowned even slightly), have a look here before even thinking about downloading the samples:

How to Use Drag and Drop and Data Transfer

Then, if you're using NetBeans IDE 5.0, here are the samples:

And, rebuilt for NetBeans IDE 5.5 dev build (from a few days ago, so buyer beware), here are the samples:

I would appreciate feedback on the above samples, especially the Simpsons one (which, in the tutorial, will not have the Simpsons characters, so don't worry, legal eagles). Would be good to know how useful and complete it is to you, before working on the tutorial. Meantime, happy drag and dropping!

Comments:

I have to say that I love this blog. I haven't done anything with the NetBeans platform yet - but I hope to soon. I installed the IDE 5.0 files above, but have no new sample projects. What do I have to do?

Posted by Stephen on July 05, 2006 at 07:44 AM PDT #

Stephen: No, these don't create samples in the New Project wizard. They just install the functionality descirbed in this blog entry. First, open the projects in the IDE. Second, install. Then, look under the Window menu. You'll find a new menu item: "Open Simpsons Window" or "Open Letter Window". Then use those menu items and the window will open and you'll see the palettes that you see in this blog entry. Thanks for loving thia blog (I do too!). Please leave a message here about whether the sample works.

Posted by Geertjan on July 05, 2006 at 07:51 AM PDT #

OK, thanks, got it! Works for me. Comments: 1. there is no icon visible while dragging the Simpsons around, 2. the top left of the dropped icon is always set to the drop point, regardless of where on the icon you clicked when starting the drag, and 3. words can only replace words, not be inserted between them. No doubt, these are just because it's an early prototype. When dropping words on the palette I sometimes got an empty word which, when removed, asked if I wanted to remove null. There may be a check for null missing somewhere. Often, when dropping words on the palette the little cursor that shows where the word will end up on the palette would remain there after the drop. It disappears if you drag over it again on a subsequent DnD.

Posted by Stephen on July 05, 2006 at 10:47 PM PDT #

Hi Stephen, sorry for the delay getting back to you. Yes, there's no ion when dragging the Simpsons around. I'd like to work on adding that, not sure how to do it yet. Your second point -- isn't that the way it is supposed to be? Your third point -- that's the way the sample is designed: you can only drop words on top of other words, not between them. There's comments in the code itself, telling you what to change in order to be able to drop the word anywhere, and not just on top of other words. I don't know about the problem about dropping words on the palette -- they do need to be dropped within one of the existing categories, maybe that's where the problem is in your case. Thanks for these comments, I've passed them on to Stan, who created the samples, and let's see what he has to say about them.

Posted by Geertjan on July 08, 2006 at 08:29 PM PDT #

I could not find the sample "org-netbeans-LetterDNDSample5.5.nbm" this given link is not working can you send me the new URL .

Posted by guest on July 23, 2012 at 04:01 AM PDT #

No, sorry, don't have these anymore. But they're old anyway and use old APIs that are not usable anymore. If you look at the date of this blog entry, you'll see it's 2006!

Posted by Geertjan on July 23, 2012 at 04:19 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today