🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7388

Re: datatype question.

#7388
From: Michael Rachow
Date: Mon, 25 Jun 2001 20:25
40 lines
2674 bytes
In short.
Usually some of Javas containers (trees, lists) have the opportunity to
connect a listz entry with a so called UserObject. This can be a more
complex object (HashMap, Vector) although in most examples a String is used
only.
In that object you can store all data you want to tie to a list entry.
Usually that UserObject has to respond to the method call toString with the
String to want to have as list entry. If an entry gets selected you can get
the corresponding UserObject, pull out of it your needed data (ID) and
locate the record you want with it.

Michael
benutzer <benutzer@besteshop.de> schrieb in im Newsbeitrag:
3B375DF7.216CBE7D@besteshop.de...
> hi i have some problems finding the appropriate datatype for the task i
> want my applet to do. i get pairs of two values from a DB-table (
> "item_id" and "item_name"). I display the names in a JList-Component via
> a DefaultListModel-Class.
>
> Now I want to give the user the opportunity to select one or more names
> from the ListBox and start doing something with the Items, based on
> their ID ( not the index in the List, but the DB-id I got in the
> beginning. Is there an elegant way to store the both values TOGETHER,
> and may be pass the names to the ListBox ? So what i would need to do
> is, somehow keep the association between the string in the list box and
> it's original item_id in the database.
>
> I was working with Delphi a lot, so my thoughts are inspired by Delphis
> helper-Classes, providing listtypes that have methods like .isInList(
> Key : String ... ) : Bool. I am very new to Java and don't have an indea
> of all the classes out there in the JDK, so I would be happy for anny
> suggestion about selecting the right types for my problem .
>
> Hope I could make myself clear ...
>
> Regards
>
> Markward Schubert
>
>
Technical Details
Message-ID: <3b379da2_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3B375DF7.216CBE7D@besteshop.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,1dc455942037281f
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-25 13:29:47 PST
From: "Michael Rachow" <michael@famrachow.de>
Newsgroups: borland.public.jbuilder.java.language
References: <3B375DF7.216CBE7D@besteshop.de>
Subject: Re: datatype question.
Date: Mon, 25 Jun 2001 22:25:49 +0200
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 217.227.17.229
Message-ID: <3b379da2_2@dnews>
X-Trace: dnews 993500578 217.227.17.229 (25 Jun 2001 13:22:58 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews