πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: jdbNavComboBox and eventhandling?

#9139
From: Paul Furbacher [TeamB]
Date: Tue, 16 May 2000 00:00
55 lines
3066 bytes
"RenοΏ½ Thomsen" wrote:
> 
> when trying to use some of the member functions of the jdbnavcombobox
> (editorcomponent related?)
> an exception occurs.
> 
> [...]
> java.lang.InternalError: Cannot use this method with a non-Mutable data
> model.
>         at
> javax.swing.JComboBox.checkMutableComboBoxModel(JComboBox.java:506)
>         at javax.swing.JComboBox.removeAllItems(JComboBox.java:489)
>         at untitled4.Applet1.jbInit(Applet1.java:84)
>         at untitled4.Applet1.init(Applet1.java:38)
>         at sun.applet.AppletPanel.run(Compiled Code)
>         at java.lang.Thread.run(Compiled Code)
> 
> i cant use the textfields functions since it havent got a removeallitems()
> function
> please help...
> is this a bug in the language, what good is a component without decent
> eventhandling?

Hold your horses.  The initial problem was to find a way to listen
to keystrokes in a JdbNavComboBox.  I made several suggestions.
After following those, did you succeed in adding listeners?

Now, your current problem is one in which you are trying 
to add items to a JdbNavComboBox model.  When you do that, you
get the "non-mutable data model" error.  This is different
from listening to events.  Furthermore, decent event handling
is the result of you and me -- i.e., the programmers who use the 
library -- writing good event handling code.

Let's also backtrack a little on what a nav combobox is: it's a 
combobox which is bound to a dataset and it's purpose is to 
navigate that dataset.  So, the contents of its model derive
from the column to which the combobox is bound.  Therefore, 
in order to correctly navigate, the list must stay in-sync
with the contents of the dataset.  Hence, the model is 
non-mutable.

Okay, so you have to start looking for alternative approaches.
What in this whole setup is mutable?  Well, the dataset is.  
How about deleting or adding a row to the dataset?  For each
row you delete (assuming you have unique values in the column
to which the combobox is attached), you should see that one item
in the combobox's list is removed.  For a new row, make 
sure there is a unique value in the column to which the combobox 
is bound.  You may have to do a small bit of research on deleting 
and inserting rows into a dataset, but this should be pretty 
straightforward.


Paul Furbacher (TeamB)
Technical Details
Message-ID: <39218A91.C2AA5613@home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8fgtpv$iot2@bornews.borland.com> <391C19C5.3396C61C@home.com> <8fooi3$3vn4@bornews.borland.com> <8frjep$2jk2@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,e90c7079d92d94ee
X-Google-Attributes: gid111d45,public
From: "Paul Furbacher [TeamB]" <pnf@home.com>
Subject: Re: jdbNavComboBox and eventhandling?
Date: 2000/05/16
Message-ID: <39218A91.C2AA5613@home.com>
X-Deja-AN: 624163065
Content-Transfer-Encoding: 8bit
References: <8fgtpv$iot2@bornews.borland.com> <391C19C5.3396C61C@home.com> <8fooi3$3vn4@bornews.borland.com> <8frjep$2jk2@bornews.borland.com>
X-Accept-Language: en,pdf
Content-Type: text/plain; charset=iso-8859-1
Organization: Reverse Alchemy, Inc.
Mime-Version: 1.0
Reply-To: pnf@home.com
Newsgroups: borland.public.jbuilder.java.swing