🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JBuilder3, JList & Sorting

#9853
From: Paul Furbacher [TeamB]
Date: Mon, 10 Jan 2000 00:00
23 lines
1245 bytes
After writing the following, I saw John McGarth's answer in
another newsgroup.  His suggestion, to implement the 
Comparable interface in your custom object, is definitely 
the more straightforward approach. 

I wrote:

> Create a custom Comparator class.  Override the "compare()" method.
> In that method, typecast the Object parameters to your custom class.
> Get the instance variable you want to base the comparison on.

> public class MyObject {
> 
>   public String name;
>   public int value;
> 
>   public MyObject() { ... }
>   ...
> }
>Now, the custom Comparator:


Paul Furbacher  (TeamB)
Technical Details
Message-ID: <387A9742.40C63D1D@bilbo.bio.purdue.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <85325s$qhr30@bornews.borland.com> <387A6DD2.69DAB413@bilbo.bio.purdue.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,77c74362b77ebaef
X-Google-Attributes: gid111d45,public
From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu>
Subject: Re: JBuilder3, JList & Sorting
Date: 2000/01/10
Message-ID: <387A9742.40C63D1D@bilbo.bio.purdue.edu>
X-Deja-AN: 570992379
Content-Transfer-Encoding: 7bit
References: <85325s$qhr30@bornews.borland.com> <387A6DD2.69DAB413@bilbo.bio.purdue.edu>
Content-Type: text/plain; charset=us-ascii
Organization: Reverse Alchemy, Inc.
Mime-Version: 1.0
Reply-To: pf@bilbo.bio.purdue.edu
Newsgroups: borland.public.jbuilder.java.swing