Article View: borland.public.jbuilder.java.swing
Article #810previously debugged code not working in JBX - ListSelectionListener
From: Glen Hanket
Date: Sat, 17 Jul 2004 00:04
Date: Sat, 17 Jul 2004 00:04
62 lines
3639 bytes
3639 bytes
Help!
I recently bought a new PC, and decided to upgrade from JBuilder5. The
code I developed in JB5 now has a bug in it, in a class that implements
ListSelectionListener and contains a DefaultListModel. The code waits
for a click on an entry in the list, and then should delete it from the
list so I can display it for editing elsewhere in the dialog box.
My code inside SummaryPane (which implements the listener):
*51* public void valueChanged(ListSelectionEvent evt) {
*52* if ( !evt.getValueIsAdjusting() )
*53* {
*54* JList source = (JList)evt.getSource();
*55* BHXLines line = (BHXLines)source.getSelectedValue();
*56* parent.editLine(line);
*57* }
*58* }
The resulting null-pointer exception:
java.lang.NullPointerException
at dialogs.DialogExpense.moveLineData(DialogExpense.java:217)
at dialogs.SplitsDialog.editLine(SplitsDialog.java:99)
at dialogs.SummaryPane.valueChanged(SummaryPane.java:56)
at javax.swing.JList.fireSelectionValueChanged(JList.java:1321)
at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1335)
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
at
javax.swing.DefaultListSelectionModel.removeIndexInterval(DefaultListSelectionModel.java:546)
at
javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(BasicListUI.java:1561)
at
javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:160)
at javax.swing.DefaultListModel.removeElement(DefaultListModel.java:364)
at dialogs.SummaryPane.remove(SummaryPane.java:65)
at dialogs.SplitsDialog.editLine(SplitsDialog.java:97)
at dialogs.SummaryPane.valueChanged(SummaryPane.java:56) *** first
entry to my program
at javax.swing.JList.fireSelectionValueChanged(JList.java:1321)
at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1335)
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:157)
Thus, after it enters my code with a non-null line, it eventually enters
DefaultListModel.removeElement - and next thing I know I'm getting
called at the same entry point with a null entry.
I'm stumped (and when I tried to open JBuilderX help, it can't find ANY
help files whatsoever, so I can't look to see if the class has changed.
Can anyone help me out?
Thanks in advance!
Glen Hanket
Technical Details
Message-ID:
<40f86d1a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,6198df393cba180c,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 16 Jul 2004 18:04:42 -0600 From: Glen Hanket <ghanket@toast.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: previously debugged code not working in JBX - ListSelectionListener Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 206.149.132.31 Message-ID: <40f86d1a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1090022682 206.149.132.31 (16 Jul 2004 17:04:42 -0700) Lines: 63 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail