Bees Are Social By Nature

Transcribed thoughts and experiences about computer programming.

A First Glance at jSeamless

After a few days of attempting to connect to http://www.jseamless.org, I was finally able to download the binaries and see if it was as wonderful as I hoped it would be. Since I had recently went through a quick implementation, though hack might be more appropriate, of a simple single player Blackjack game using Echo2, I thought it would be great to take the same logic and apply it to my first glance at jSeamless. I had the game, I just needed the user interface.

Using the HelloJSeamless Sample Application and the Eclipse Web Tools Platform, I was able to quickly get my development environment and my first project set up. I set the project to run on Tomcat 5.5, hit run, and the HelloJSeamless Sample Application was up and running. I am not a big fan of “Hello World” type applications as they don’t really show me much, but it was great that one was provided.

The next step for me was to see how easy it was to “port” my simple, and needlessly server-side, Blackjack game from Echo2 to jSeamless. As I started digging in, I realized that I had forgot to download any documentation or the source and found I was fumbling around in the dark, with nothing more than the jar containing the class files and the HelloJSeamless sample applications. I tried to go back to the website to get more information, yet the jSeamless site was experiencing technical difficulties to my great frustration, at which time I reminded myself that this is a Beta release. Being as determined as I am, I decided to work through to get some sort of working version by hoping my experience with Swing, QT, MFC, and other GUI Frameworks and the class files would allow me to come up with something that worked.

I quickly found classes like Window, Grid, Label, Button, Table, TableRow, TableCell, and Style and started to feel a little more comfortable. With some minor experimentation I was able to get a simple Window with some Labels and some Buttons. I set up the buttons to take my implementation of the ActionListener and implemented the action(ActionEvent) method and was confused because I couldn’t figure out how to drill down and get specific information about the ActionEvent that occured when a given button was pressed. My first pass at the code looked like:


public class JSeamlessBlackjack extends Application implements ActionListener {
...
public void initPane() {
...
hit = new Button("Hit");
hit.setEnabled(false);
hit.addActionListener(this);
...
}
public void action(ActionEvent e) {
// if () doHit(); I want to do some conditional on ActionEvent
// Since I don't have docs lets see what an ActionEvent has in it.
System.out.println(e.getType());
... more output statements
}
}

The results of this first pass, were simply Click and CLICK, with nothing to differentiate it from any other button that my ActionListener may have been listening to. As such, I was forced to implement as follows:

hit.addActionListener(new ActionListener() {
public void action(ActionEvent e) {
doHit(); }
});

While this isn’t “bad”, it’s just not my preferred way of implementing ActionListeners. Please note that I had no documentation at this point, so I had no idea if I had other options. I stumbled around for about an hour “porting” my Blackjack application, hit run, and I got decent results, which can be found at http://www.kriggio.com/JSeamlessBlackjack.

The performance of my first application was not as good as I had hoped and the lack of documentation made this first experiment much more painful that I would have hoped. I just went back to the site, about an hour prior to this posting, and found that the site was operational again and I immediately downloaded the source and the javadocs. I have hopes that they will provide greater insight into using the framework, but my expectations are fairly low, as I keep forgetting this is a Beta version.

In the end, I wasn’t as “wowed” as I hoped I would have been, but I must say that Matthew Hicks has done some excellent work with this project. I realize I may voice some level of disappointment, but I had extremely high expectations. While those expectations were not met in his Beta 3 version, this is still GREAT stuff and I look forward to future versions, and maybe after reading the Javadocs and Source files I will appreciate what he has accomplished with jSeamless even more.

My extremely ugly hackage I call my JSeamlessBlackjack source can be found at http://www.kriggio.com/EchoBlackjack/JSeamlessBlackjack.zip.

Update: Unfortunately, reading the Javadocs and Source for jSeamless provided no greater insight that just reading the byte-code.

Advertisements

May 30, 2007 Posted by | java, Programming, technology, Web 2.0 | 3 Comments