Great news from the OpenJDK swing-generics project: my patch to "generify" JList, along with AbstractListModel, DefaultListCellRenderer, DefaultListModel, ListCellRenderer and ListModel, has been commited to the OpenJDK/ Swing repository!
This patch helps writing more stable code.
Eg. instead of writing something like:
with this patch you can write now:
Note that:
JList.getSelectedValues(): Object[] has been deprecated and replaced with:
JList.getSelectedValuesList(): List<E>
Have a look at the jtreg tests to see more examples.
If you're interested in the future of Swing, join the discussions in the OpenJDK Swing mailing list.
Subscribe to:
Post Comments (Atom)
Congrats, this is a real step forward! Does this also mean that the ListCellRenderer interface will have a generic type?
ReplyDeleteYes, ListCellRenderer has a generic type parameter, too. See:
ReplyDeletehttp://hg.openjdk.java.net/jdk7/swing/jdk/file/7bcb1864f424/src/share/classes/javax/swing/ListCellRenderer.java
Super good :D
ReplyDeleteThat's the parameter I use.
ReplyDelete