Article View: borland.public.jbuilder.java.swing
Article #9151Re: jdbNavComboBox and eventhandling?
From: Ren� Thomsen
Date: Thu, 18 May 2000 00:00
Date: Thu, 18 May 2000 00:00
81 lines
4013 bytes
4013 bytes
the solution you provided works as far as adding the listener goes... but when resetting the jdbnavcbpx with e.g. removeAllitems, the error occurs. i know the component is designed for dataaware functionality, but if an event is nonworking maybe it should be grayed out? the trick you gave worked but is causing other member functions not to work as desribed above. im a former c++ programmer and i LOVE the borland products. i just feel im wasting my time researching how to catch event there should be available by default OR grayed out. sorry if i sound a little irritated, but my employer is pushing me all the time, and i cant push the code. any help appriciated regards Ren� Thomsen Software Engineer. BankInvest. Denmark "Paul Furbacher [TeamB]" <pnf@home.com> wrote in message news:39218A91.C2AA5613@home.com... > "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:
<8g0jhn$k8m2@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8fgtpv$iot2@bornews.borland.com> <391C19C5.3396C61C@home.com> <8fooi3$3vn4@bornews.borland.com> <8frjep$2jk2@bornews.borland.com> <39218A91.C2AA5613@home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,e90c7079d92d94ee X-Google-Attributes: gid111d45,public From: "Ren� Thomsen" <rtNOSPAM@bankinvest.dk> Subject: Re: jdbNavComboBox and eventhandling? Date: 2000/05/18 Message-ID: <8g0jhn$k8m2@bornews.borland.com> X-Deja-AN: 624939692 References: <8fgtpv$iot2@bornews.borland.com> <391C19C5.3396C61C@home.com> <8fooi3$3vn4@bornews.borland.com> <8frjep$2jk2@bornews.borland.com> <39218A91.C2AA5613@home.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing