Geertjan's Blog

  • April 18, 2006

Music NotePad (Part 3)

Geertjan Wielenga
Product Manager
I feel a little bit like that dude who invented the telephone. So, hurray, my Music NotePad works! My very first application built on the NetBeans Platform. Check it out—now, when you drop an item from the palette on the music sheet, the related note and duration are added to the editor. Same for the instruments—just click a button and the instrument is added to the editor. (Note that now there's a wider selection of instruments, made available by a scroll deal.) Then, when you choose File > Play, the content of the editor is played. Here's what it all looks like:

Obvious problems are that you can't move an item after it has been dropped and that you must drop items from left to right (you can't insert something in between previously dropped notes). Ah, but that will come. The important thing is that right now, you can visually compose your music and play it (rather than choosing items from various clumsy lists).

Something else I want to do is migrate the syntax highlighting from my earlier implementation to this one. Maybe it is possible to make the font of the note larger in the editor, in addition to giving it a distinctive color. That's something I'll investigate. Not much sense in creating syntax highlighting for this very simple syntax, but it would definitely make the editor look a bit more festive than it does now.

The coolest thing I learnt while working on this application is the beauty of topcomponents. They're really cool. When you use a NetBeans topcomponent in your application, you get a whole bunch of free functionality. In the Music NotePad, I have four topcomponents—the pad, the palette, the editor, and the instruments. (Okay, the palette isn't really a topcomponent, but it acts like one. So maybe that means that it is a topcomponent after all.) Without doing any programming at all, I (now, as the end user of the application) get the following cool "Minimize" functionality for free—when I click the "Minimize" buttons on the palette and the editor, this is the cool effect that I get for free:

On top of that, because of the same coolness of the topcomponent, I (again, as the end user) can move them around by dragging and dropping them from one position to another:

So, building your application "on top of the NetBeans Platform" means that there's a lot of the IDE's underlying infrastructure that you get free out of the box in your own applications. When you consider, on top of that, that you have Matisse as your layout manager (for free and out of the box), I honestly (could this be my first marketing message in this entire blog) can't imagine a better platform to build your applications on.

Join the discussion

Comments ( 11 )
  • Alex Lam Tuesday, April 18, 2006
    Looks cool - would you mind testing the Napkin module to see if it works in a NB Platform application? I have developed and compiled the module against NetBeans Platform in the hope of it working with any applications on top of this RCP ;-)
  • Geertjan Tuesday, April 18, 2006
    Cretianly. Send me a link or something where I can get it from.
  • Geertjan Tuesday, April 18, 2006
    Oops. "Cretianly" should have been "Certainly".
  • Alex Lam Tuesday, April 18, 2006
    The update center is at http://napkinlaf.sourceforge.net/netbeans/updates.xml
  • Geertjan Tuesday, April 18, 2006
    Thanks Alex. Check back tomorrow and I'll blog about the results... :-)
  • Alex Lam Tuesday, April 18, 2006
    Cheers~ ;-)
  • Daniel D. Mendes Tuesday, April 18, 2006
    Just one thing... where are the mp3 files? :) you have to do a new blog entry with some of your compositions ;)
  • Geertjan Tuesday, April 18, 2006
    Daniel, one thing I haven't migrated from my initial implementation yet is the "Save" functionality. What this does, in about two lines of code, is call a method in the JFugue API that saves the music string (from the editor in my Music NotePad) as a Midi file. I'm planning to add that functionality tomorrow. And then... maybe I'll share some of my compositions with the world. (The cool thing is that in the next release of JFugue, I'll also be able to open existing Midi files inside my Music NotePad. So I could open a Beethoven symphony and... improve it!)
  • Daniel D. Mendes Tuesday, April 18, 2006
    That is pretty cool... keep working on it, it will be a great example of the NetBeans RCP flexibility... and of java in general. That beethoven guy, he ain't got nothing on you ;)
  • Stephen Fitzgerald Tuesday, April 18, 2006
    Can I get a look at the source for this? I'm about to start a Netbeans Platform application (I think), and evrery example helps.
  • Geertjan Wednesday, April 19, 2006
    Thanks Daniel for the encouragement. Yeah, that Beethoven dude, what a hack that guy was. Must be rolling in his grave right now going: "If only I had had the Music NotePad." (But then in German.)

    Stephen, you're in luck because there are several cool quick starts and tutorials available if you go to http://platform.netbeans.org/tutorials. There are also samples in the IDE itself. One is a FeedReader and the other, if you install the Update 1 from the Update Center, is a paint application. But both are described in tutorials on the above page. My own application isn't complete enough yet to release to the world. Please keep in touch and ask any questions you need to ask (also join dev@openide.netbeans.org, where you'll be able to ask questions of the NetBeans engineers (as well as many other people) who made the NetBeans Platform, the NetBeans APIs, and the NetBeans IDE itself.

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