Geertjan's Blog

  • August 18, 2011

"More Complex" NetBeans Platform Samples... (Part 1)

Geertjan Wielenga
Product Manager

Sometimes I read about people wanting "more complex" NetBeans Platform samples. The general complaint is that the NetBeans Platform documentation & tutorials are nice for getting started but that after that you're pretty much on your own. I'm not sure in how far that is actually true (at this point, there's not much that hasn't been documented somewhere somehow), but the question I'd like to ask in this blog entry is:

What exactly is meant by "more complex" NetBeans Platform samples?

Tell me what "more complex" NetBeans Platform samples are and I will see to it that the requested sample code is put together. If someone leaves a comment in this blog entry that is clear & specific enough (and note that your comment will simply not be published if the commentor's name is "guest" or "anonymous" or anything like that), I promise that I will blog a step by step explanation of how to do whatever it is or write a tutorial that will be added to the official list of NetBeans Platform tutorials.

Here's one scenario that I could imagine being in the category "more complex":

In the scenario above, you can right-click in the TopComponent on the left and then create new items. Then, you can select a new item, by checking in an item's checkbox, and it will be added in the TopComponent on the right. When you unselect a selected item, it will be removed from the TopComponent on the right.

Here are the sources of the above more complex sample in Subversion:


If you have a similar scenario, along the lines above, i.e., "how do I do XYZ while ABC is doing DEF" (and NOT "how do I create a toolbar", which is an example of something described multiple times in the tutorials and FAQs already), feel free to describe that "more complex" scenario in the comments at the end of this blog entry.

Join the discussion

Comments ( 17 )
  • Farouk Alhassan Thursday, August 18, 2011

    For me, a complex example will be something like an ebay turbo lister. That will include laying out pictures on a screen, using a menu system that looks completely different from the IDE, connects to the internet via SOAP, retreives records including images and handles a multi-step process for complex actions like creating a new listing.

    Another example will be to complete your content management examples using an embeded DB, image manipulation with the Imagine library, draging and droping html components, using the lexer and syntax high lighting and a multi-step publishing including reviews from other users.

    Another example can be an email management system that aggregates all a users email from the various public email vendors, allows the user to manage all emails from the same location with attachments and rich text editting

  • guest Friday, August 19, 2011

    My list would be:

    - Sample application connecting to an application server (e.g. glassfish) via RMI where the changes inside of the platform application are synced with the application server (e.g. change a textfield and the changes are stored in the database connected to the application server)automatically.

    - The same above using webservice

    - Sample application using a database localy and sync the gui automatically to the database.

    All requested samples above requesting that the user does not have to click on a "save" button to store the information to the disk/database/application server. From my view this combines the advantage of web applications with desktop applications.



  • guest Friday, August 19, 2011

    I'm stuck with an apparently simple problem: connecting a NetBeans RCP app with EJBs on Glassfish 3.1.1 via RMI-IIOP: as I wrote on dev@platform.netbeans.org, probably there is no solution - and that's ironic (or dramatic;).

    Another 'enterprise' feature: a permission mechanism. How to conditionally load menus/windows/whatever based on permissions collected after a login dialog.

    We have developed a permission system, but it's flawed in many ways (I can give you more details on the problems we have on a big enterprise app, if needed) and the solutions I read googling around are simplicistic.

    Finally, a big bonus: how to clone Geertjan Wielenga...

    Thank you for your invaluable work.


  • Toni Friday, August 19, 2011

    Hi Geertjan,

    very good question :-). In my personal opinion the value of "complex" applications is limited for teaching or learning, because the domain logic they require gets in the way of understanding the platform specific stuff.

    Still if you need them, there are a lot of complex examples out there, a lot of the applications on the screenshot page are open source. BlueMarine (http://kenai.com/projects/bluemarine/) is one of them and Fabrizio has discussed the architecture of this applications in several blog entries. Studying this application together with his articles might help to get beyond the basics. He also has changed the appearance of the application alot. Also "Imagine" by Tim Boudreau might be a good example (http://java.net/projects/imagine), because it really focuses on modularity.

    Maybe having students extend it in a course (e.g. in Göttingen) would be a good exercise...


  • dannyb Friday, August 19, 2011

    I would like to see more examples of debugger api that don't just stub out the calls into the debugger engine. The code completion examples never really worked for me.



  • Geertjan Saturday, August 20, 2011

    Thanks all for the comments, will work on these in the coming period.

    And, Danny, can't help you with meaningless comments like "The code completion examples never really worked for me." -- i.e., if you don't provide details on (1) which example (2) which step and (3) which error you're dealing with, I (4) am not going to be able to help you, no matter how much I'd like to do so.

  • guest Saturday, August 20, 2011

    Hi Geertjan,

    While not really a request for a "more complex" example, I am looking for some docuementation on hooking into the Java indexing system - trying to implement support for an external language that will provide byte-code enhancement for classes being edited, providing members that are not in the "java" source - so would need to be able to add to the index that the existing java tools have created - to feed code completion etc.

  • antony Saturday, August 20, 2011

    Hi Geertjan

    Thanks for all the fantastic examples and advice - you are a superstar. Sorry if this has been covered elsewhere as a complete example - It would be useful to have a bare bones/skeleton but complete example to include:

    1) Loading a node hierarchy for three very simple but related tables (say company[idcompany, companyname], company_departments[idcompanydept, idcompany,departmentname], company_department_functions [iddeptfunction, idcompanydept, function) into an outline;

    2) Include JPA, not blocking EDT, and, loading progress type activities;

    3) CRUD @ all three table levels, to include single or multiple nodes in each aspect of CRUD;

    4) Include the kind of functionality discussed in your recent articles on capabilities.

    Hope that makes sense and thanks again for all the brilliant stuff you do for us.


  • guest Sunday, August 21, 2011

    Hi Geertjan,

    I've been trying to create a explorer top component with a tree that supports checkboxes. I've seen your posts on that topic and your post on the file browser module.

    I've managed to create a tree exactly how I want it, using my own tree model and the DefaultOutlineModel.createOutlineModel method.

    The issue is that the examples you have posted on check nodes don't fit in my application (or at least I think so) because I need a tree in which any node can be either a leaf or a parent node, and only leafs can have checkboxes. For example:


    +-Folder 1

    ++-File 1.1

    ++-File 1.2

    +-Folder 2

    ++-Folder 2.1

    +++-Folder 2.1.1


    +-Folder 3

    ++-File 3.1

    In my application only files can have a checkbox. I've managed to add checkboxes putting the nodes in an ExplorerManager object, but I need to put the checkboxes in an outline object.

    Other than your blog, there is not much info related on this particular subject.

    Thank you very much for your posts, ther have been really, really useful!. They contribute to the growth of the Netbeans Platform developers community.


  • Victor Ramirez Tuesday, August 23, 2011

    Hi Geertjan,

    A "more complex" sample for me woulde be something like an SCP GUI explorer. That would be a very complete sample as it involves networking, and OS, thanks for this blog posts!

  • Enrique Perez-Soler Thursday, August 25, 2011

    // Sorry, in posted this as "guest" 1 minute ago, I repost with my full name

    for (Object o : Lookup.getDefault().lookupAll(Greetings.class))


    Hi Geertjan,

    first of all, as stated, thank you very much for your intense information production to assist Netbeans platform developers.

    I have been using Netbeans IDE for years, and decided to take advantage of the platform about 2-3 weeks ago. I have read almost every tutorial at Netbeans.org and watched all your screencasts, twice at least each.

    In my humble opinion, Netbeans concept is great and simple, but getting in is hard and confusing. Your screencasts are just perfect to 'get the idea', yet the javadocs are too much specification styled. I am missing more tutorials mixing code and explanations, specially covering the Visual Library in wider extent.

    My complex application is a graphical editor allowing dropping components from a palette to a canvas, connecting them, and presenting a tree which updates with widget addition, deletion and edition. Later, the graph must be compiled and run to drive some external USB external devices.

    I am not asking for an example covering that at all, my brain should find its way (though a pointer to such an editor would be much appreciated ;-). I simply wanted to point that, knowing the existence of the lookup, I have spent almost three full days trying to comply with this design approach with making the tree discover the widgets thrown into the canvas using the lookup.

    I have been unsuccessful because of two main reasons:

    First, I haven't found any "lookup.add(stuff)" method with which the scene could update a lookup as widgets are added or removed, so that the Tree can be notified by a lookup result.

    Second, trying also to adhere to the loose coupling philosophy, it is a mistery to me how I could share a lookup between the tree and the scene without having them knowing each other (since I consider using the global lookup for this purpose is very dirty).

    Finally, a solution has appeared with the sample application you provide in this post, (thanks again). This communication between two TopComponents is made through the static methods of the Utils class!! No lookup is used at all.

    Do you consider this is an ugly workaround, or a sound Netbeans implementation?

    Thanks a lot for your comments.

  • dannyb Sunday, August 28, 2011

    yeah sorry it was a useless comment. Basically "Implementing the Tooltip and Documentation Task" didn't show the tool tip or the documentation, did nothing. I dont remember getting any errors. Not sure if it is simply a case i was using the wrong version of netbeans - it was 6.9 and this was a year ago.

  • Geertjan Sunday, August 28, 2011

    Still impossible to help you. If you send me the code (geertjan.wielenga at oracle.com), I'd be happy to look into it.

  • Magallo Monday, February 25, 2013

    Hi Geertjan. Thank you for this blog entry. I have to implement something that I consider "more complex" than usual dummy tutorials on NetBeans Platform. I hope you could help me giving me some hints on how to implement this.

    I have an application with two main windows. This two main windows should show some data in different ways. One window is a list (table), the other window is a chart. The window containing the list (table) should be filled with data coming from a 'background task' that should monitor a file and read data from this file. Every time the file changes (by an external program), this background task should read the content of the file and notify the fact that the data has changed to the windows containing the list (table). This 'background task' should be a background thread or a background module or whatever. It should be started automatically by the application when it starts, independently from the windows opened. The second window is a chart window that should show some data, depending on a set of options set by the user. For this reason I need a third window, that is an 'option' window, where the user could set some options via checkboxes/textboxes/whatever. When the user chooses its options, then it should, pressing a button or whatever, notify the chart windows that the options are changed and the chard should display data accordingly. So I need a way to notify the chart window that the options are changed and also what are the options. In a particular case, the options should say to the chart window, to take data the same way the list (table) window does. In this case, the background task should notify not only the list (table) window, but also the chart window. How to do that? I hope my explanation was clear enough. Summarizing:

    - I want to create a 'chart' window, a 'list' window and an 'options' window.

    - I need to start a background task/thread/module that works in background independently.

    - This background task reads data from a file, and every time the file has changed, it reads data and should notify to the 'list' window that new data are available and what this data are. Eventually, based on options set on the 'options ' window, this notification mechanism should be done not only to the 'list' window but also to the 'chart' window. A sort of observer/listener mechanism?

    - The 'options' window let the user to choose some options. When the user changes one or more options parameters, using a button (or whatever), it should notify to the 'chart' window that options are changed and what options are.

    The problem is that I don't have any idea on what is the NetBeans platform way to do this. Using the Lookapi api or whatever. No idea how to proceed.

    Please help.

  • Geertjan Monday, February 25, 2013

    OK, will publish a movie on YouTube around this scenario in the coming days. Stay tuned. And feel free to drop me an e-mail at geertjan.wielenga@oracle.com.

  • Magallo Tuesday, February 26, 2013

    That's great! Thank you very much!

  • Magallo Tuesday, March 5, 2013

    Ok, sorry for the off topic. Anyway I think this is a topic that should be faced because it frighten a lot of people I guess.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.