Simple Yahoo! News Reader

My last few blogs have been on using web services in Swing. This time I've created a simple Yahoo! News RSS reader JavaBean you can use in your own apps. And yes, this time I went all the way and wrote a JNLP.

My last few blogs have been on using web services in Swing. This time I've created a simple Yahoo! News RSS reader JavaBean you can use in your own apps. And yes, this time I went all the way and wrote a JNLP. But beware, it is only running on 1.6 for now. I didn't even know I was developing on 1.6 until I tested the deploy, and now I'm headed out on vacation.

Here's a screenshot, for those you can't or won't run the demo:

It is a very ugly demo. Again, vacation and all that. But, here's basically what it does. You enter the name of the feed you'd like to see in the combo box on the top. Or you can pick one of the predefined ones, its up to you. Then click the "Refresh" button. On a background thread (there ya go, vtech!) I get the feed results, parse them, and then back on the UI thread I load them into the JTextArea. The results are raw output from the ROME RSS reader which I use to do all the heavy lifting.

[2]

The point here isn't to show off some slick looking application -- its the work that went into creating it. Or the lack thereof. Read the source code yourself.[3] You can also download the sources[4] and rebuild the project (but good luck getting it to load up in NetBeans. Sorry no time to make it pretty, vacation calls).

For the impatient, here's the source code boiled down. First, I created a YahooNews bean (well, after creating the UI). I then created a BackgroundWorker bean called "worker". I then filled in the BackgroundWorker's event handlers, and wrote an action listener for the "Refresh" button. Here's all the magic: