On Thu, 15 Dec 2011 21:48:06 -0800, Knute Johnson
<nospam@knutejohnson.com> wrote, quoted or indirectly quoted someone
who said :
public class KList extends JList {
ListModel model = new DefaultListModel();
If you were just using JList by itself you would say:
final JList<String> flavour = new JList<String>( new String[] {
"strawberry", "chocolate", "vanilla" } );
Your new class KList can have a built-in fixed contained type, e.g.
String or it can have a variable one.
The first is pretty obvious :
class KList extends JList<String>
The second you can discover by looking for some similar Sun code in
src.zip, e.g.
public interface MutableComboBoxModel<E> extends ComboBoxModel<E> {
so I would think
KList<E> extends JList<E>
should work.
For additional hints, see http://mindprod.com/jgloss/generics.html
and links
I have not tested this and quite commonly things in generics I think
should work do not. Take this just as a hint of something to try.
Yeah, unfortunately that doesn't work. Is it possible to extend JList