I’m looking at writing a small app, with the requirements of being cross-platform with a file-based database and able to play midi files. Java looks promising, but with a background in Visual Basic it seems a bit daunting.
Anyone have experience with Java, particularly with the SWT GUI toolkit? Development of the user interface hardly seems to be drag and drop…
I would be grateful to hear of any decent tutorials and whether anyone has successfully transferred from VB to Java (or to an alternative I’m overlooking).
I hear Netbeans has good drag-and-drop GUI building (for Swing, probably not for SWT), but I’m pretty particular to Eclipse.
If you’re really stuck on SWT for some reason, Eclipse RCP would be the way to go. I have no experience with SWT though.
There are a multitude of good Swing tutorials, notably The Swing Tutorial. They typically concentrate on writing the UI by hand, but in my experience with Java, you’re going to have to at least understand that anyways.
The good news is that Java does support MIDI playback, see the javax.sound.midi section of the API docs java.sun.com/j2se/1.5.0/docs/api/
Hope this helps,
Having read a bit further it seems that Swing is more compatible for cross-platform apps, as it draws the controls graphically, rather than relying on the underlying OS controls (as both AWT and SWT do to a greater or lesser extent). The app only needs a regular user interface and won’t be graphically challenging, so Swing should be fine. I’ve downloaded the JDK with Netbeans and the tutorials at java.sun.com/docs/books/tutorial/index.html look good.
Using an example on the web I’ve managed to get a midi file playing. Unfortunately when I added a window and moved this around the screen the midi playback stuttered badly - I’m guessing these will have to be done in different threads? It’s all a bit more complicated than VB!
The other main part I haven’t looked at yet is a file-based database. I’ve looked at SQLite in the past, but I’ll have to check if this is compatible with Java - maybe using a JDBC driver?
Stuttering MIDI playback isn’t something I’m familiar with (shouldn’t be a threading issue). You’re probably going to have to find some java support forums for that, Sun’s developer forums located here are good.
As for a database, you’re looking for an embedded database. Java has lots of good options. As of Java 6 - there is even one included, Derby, now called the Java DB. developers.sun.com/javadb/
There is also HSQLDB, which is what the FactoryPMI Gateway uses to store project/configuration information. hsqldb.org/