Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: Generics ? Date: Fri, 16 Dec 2011 22:01:08 -0800 Organization: A noiseless patient Spider Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 17 Dec 2011 06:01:08 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="mz/LDSJwiWnk3Jnnqg7x+Q"; logging-data="23830"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7DGm8elvlkHMtUxJYIMlx" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Cancel-Lock: sha1:rwtZwGbQm+8Tis13G6NA7ObUzZc= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10818 On 12/16/2011 2:10 AM, Roedy Green wrote: > On Thu, 15 Dec 2011 21:48:06 -0800, Knute Johnson > 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 flavour = new JList( 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 > > The second you can discover by looking for some similar Sun code in > src.zip, e.g. > > public interface MutableComboBoxModel extends ComboBoxModel { > > so I would think > > KList extends JList > 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 and not get unchecked warnings? -- Knute Johnson