Significant Steps Forward for JFugue Music NotePad (Part 1)
By Geertjan on Aug 10, 2007
...you can select a note (or multiple notes, by using the Ctrl key), which results in the selected notes turning red. Then you can press the up and down arrow keys to move the selected notes up and down in the score! How cool is that? Here you see three red notes, which means I selected them for moving up and down with the arrow keys:
In addition, you can see above that Michal added flats and sharps (which weren't supported before) and I added a Save button (so that you can save your compositions). The Save functionality needs to be enhanced, but basically does the job for now.
I asked Michal to explain how the editing capabilities work and he summarized the story as follows:
- StaveListener.java. Created this class for selecting notes with mouse (holding CTRL key allows selecting more than 1 note) and moving notes with up/down arrow keys.
- Stave.java. Added code for setting the StaveListener.
- SingleStave.java. Added method getNoteAtPos(...) and in method paint(...), added code for drawing the key signature (sharps, flats), and filtering the selected notes with the "red filter", added method selectNotePrefixSymbol(...) for drawing sharps, flats and restores beside notes.
- Score.java. Added some hash tables and arrays for working with notes, added method setKeySignature(...) for setting the score's basic scale and for filling the arrays: nativeNoteValues, alteredNoteValues and restoreNoteValues (these arrays are used in SingleStave::paint method).
- SelectNoteImageFilter.java. Created the "red filter" used for selected notes.
And here's a pic of Michal, the newest contributor to the JFugue Music NotePad project on dev.java.net (click here):
Finally... guess what happened when he handed his project in to his instructor? He got full marks. 20 out of 20. Michal graduated this year and will continue with his PhD. Well done Michal, that sounds like music to my ears! About the JFugue Music NotePad, Michal writes: "It was really nice to work on this project. It is well designed and I had to do only some minor changes to the existing code for implementing the editing capabilities." That's great to hear Michal, and mainly due to the Belgian developer Pierre Matthijs, who added a lot of insight and structure (and lots of code) to the project after I open sourced a rather humble beginning. It is extremely cool to hear that this project has proved beneficial to someone in their studies, who has now also learned about the NetBeans Platform. Plus, very cool that the enhancements have been contributed back to the project. Hurray for everyone!