 |
A (Barely) Better Looking Yahoo! News Demo
Posted by rbair on July 10, 2006 at 06:27 PM | Comments (7)
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() + ")";
}
}
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
You guys need help :))
Posted by: gfx on July 11, 2006 at 07:52 AM
-
Alas, my favorite UI picky-person isn't around anymore :-).
Posted by: rbair on July 11, 2006 at 08:00 AM
-
The highlighers look nice, but why don't they extend past the last list element on Aqua? Open up iTunes or iChat, and you'll see that the stripes continue past the last row. Look & feel fidelity is the name of the game.
Also, I find the use of JList for tabular data disturbing
[somewhat edited as part of editing my own post: rbair. Hope that is ok, Jesse]
Posted by: jessewilson on July 11, 2006 at 09:00 AM
-
Jesse,
We've talked a bit about how to achieve the aqua "striping past the last row" problem for both JList and JTable, but nothing was ever decided. It wasn't a straightforward thing to do because the highlighters are built on the CellRenderer level as opposed to in the table itself. Quite possibly they need to be integrated into the core of the components. I haven't looked into it much myself, but that's what I recall from the discussion.
Using a JList for this kind of data is fine. I'd rather put a custom cell renderer on here that would do a multi-line kind of layout for each cell, but its just a demo. A JTable would just look weird here, imo.
As for the last point, you'd have to be familiar with the TV series Seinfeld to get the joke. To avoid any misunderstanding, I've removed the comment.
Richard
Posted by: rbair on July 11, 2006 at 09:07 AM
-
Rock on Richard.
I agree that the 'striping past the last row' is a more difficult problem. Perhaps building the highlighters on the CellRenderer level wasn't sufficient?
The JList makes much more sense once I imagine it supporting multiple lines of text.
And I am familiar with the Soup Nazi, It was a really funny episode, and I understood that you were alluding to Seinfeld. I didn't mean to stress you out about it, I just needed something else that was as disturbing as a JList with tabular data!
Posted by: jessewilson on July 11, 2006 at 12:50 PM
-
Sweet, glad I didn't offend. I felt bad all day :-).
Regarding highlighters using Cell Renderers: I'm beginning to think renderers are not the best way to do highlighting. It seem that the Table/Tree/List should be taking a more direct route to painting the highlights. Sometimes, though, it makes sense to use renderers, such as when changing the foreground color. Even that, though, is not foolproof. If you use a custom cell renderer, you have to be sure to honor the color.
Yet another something to ponder :-)
Posted by: rbair on July 11, 2006 at 03:06 PM
-
Regarding highlighters using Cell Renderers: I'm beginning to think renderers are not the best way to do highlighting. It seem that the Table/Tree/List should be taking a more direct route to painting the highlights. Sometimes, though, it makes sense to use renderers, such as when changing the foreground color. Even that, though, is not foolproof. If you use a custom cell renderer, you have to be sure to honor the color.
Posted by: afrumare on November 08, 2006 at 01:29 AM
|