🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1384

Re: ComboBoxModel

#1384
From: John McGrath [TeamB]
Date: Thu, 18 Dec 2003 05:34
49 lines
2929 bytes
On 12/15/2003 at 9:42:35 PM, Jacklondon Chen wrote:

> In most case, we have to write a subclass of ComboBoxModel or just 
> use DefaultComboBoxModel.

I think you have the basic idea, but I have some problems with how you
describe interfaces.  You do not write a *subclass* of ComboBoxModel,
since it is an interface, not an abstract class.  You can *implement*
an interface, not *subclass* it.

> I think a good way is that sun give some tools good for simple
> application, others good for complex application.
> 
> for example, In most case, we use JComboBox for add string data and
> show and select. Sun can give a new class for this case:
> 
> 
> //--------------------------------------------------------------------
> ------ ------------------------------------>
> public class JSimpleComboBox extends JComboBox {
> 
>   public JSimpleComboBox() {
>     super(new DefaultComboBoxModel());
>   }
> 
>   public void addElement(Object obj) {
>     DefaultComboBoxModel dataModel = (DefaultComboBoxModel)
> getModel();     dataModel.addElement(obj);
>   }
> 
> }
> //<-------------------------------------------------------------------
> ------ -------------------------------------
> 
> I think in this way, programmer no need to write subclass of
> ComboBoxModel each time. It's good for simple application.

There is no need to write a subclass of ComboBoxModel (or of JComboBox)
each time.  I do not see any functionality provided by the above code
that is not provided by the JComboBox superclass.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <3fe14a70$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!newsfeed2.easynews.com!easynews.com!easynews!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f143b59$1@newsgroups.borland.com> <3fdd32b5$1@newsgroups.borland.com> <3fdd5106@newsgroups.borland.com> <3fde551a$1@newsgroups.borland.com> <3fde70fb$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,80c2106396f99c07
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-12-17 22:39:41 PST
From: "John McGrath  [TeamB]" <ng-b@JPMcGrath.net>
Subject: Re: ComboBoxModel
Newsgroups: borland.public.jbuilder.java.swing
References: <3f143b59$1@newsgroups.borland.com> <3fdd32b5$1@newsgroups.borland.com> <3fdd5106@newsgroups.borland.com> <3fde551a$1@newsgroups.borland.com> <3fde70fb$1@newsgroups.borland.com>
User-Agent: XanaNews/1.15.7.4
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
NNTP-Posting-Host: 141.158.232.159
Message-ID: <3fe14a70$1@newsgroups.borland.com>
Date: 17 Dec 2003 22:34:24 -0700
X-Trace: newsgroups.borland.com 1071729264 141.158.232.159 (17 Dec 2003 22:34:24 -0700)
Lines: 49
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!newsfeed2.easynews.com!easynews.com!easynews!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail