Skip to main content

A (Barely) Better Looking Yahoo! News Demo

Posted by rbair on July 10, 2006 at 6:27 PM PDT

I was greeted this afternoon by a retching Hans Muller who begged me to upload a better looking demo for the Yahoo! News web service I posted about last time. He likened last week's entry to a fat man in a speedo. Yikes. Here's a barely better demo (pun intended).

(Note: This one also uses Mustang. Get it here!).


As before, you can download YahooNewsDemo.java, as well as the source files and libs.

For the impatient:

and the relevant source code:

    public YahooNewsDemo() {
        initComponents();
        results.setHighlighters(new HighlighterPipeline(new Highlighter[] {AlternateRowHighlighter.beige}));
    }

    ...

    private void workerProcess(org.jdesktop.swingx.event.BackgroundEvent evt) {                              
        results.setModel(new RssListModel((SyndFeed)evt.getData()[0]));
    }                             
   

    private static final class RssListModel extends AbstractListModel {
        private SyndFeed feed;
        private List entries;
       
        public RssListModel(SyndFeed feed) {
            this.feed = feed;
            entries = feed.getEntries();
        }

        public int getSize() {
            return entries.size();
        }

        public Object getElementAt(int i) {
            SyndEntry entry = (SyndEntry)entries.get(i);
            return entry.getTitle() + " (" + entry.getPublishedDate() + ")";
        }
    }
Related Topics >>