Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1692

=?iso-8859-1?q?Re:_JCombo

From "Piet71" <piet71@THRWHITE.remove-dii-this>
Subject =?iso-8859-1?q?Re:_JCombo
Message-ID <1180161990.246418.113870@o5g2000hsb.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <dhle535d0ifibm508ng3bq6hsro09pttb0@4ax.com>
Date 2011-04-27 15:34 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Thanks for your comments, Roedy.
> The way it is, you can't tell if you problem is with JComboBox or with
> your ArrayLists and objects.
In my real program I have added lots of System.out.println's from
which I could tell that everything was working as expected and that
the selected object was updated except that the new selected object
was not shown in the JComboBox.
I have found out in the meantime that I simply need to fire an event
in my setSelectedItem method of the CombinedListModel class . Makes
sense that the JComboBox will not update its view when the
setSelectedItem method is invoked by bypassing the JComboBox. Here is
the new version. It seems to be working but is not throughly tested.
To do the testing I will have to remove that changes that I made
yesterday when desperately looking for the source of the unexpected
behaviour.
<code>
public void setSelectedItem(Object item){
    System.out.println("Selection changed");
    if(items.contains(item)){
        selected =item;
 
fireContentsChanged(this,items.indexOf(item),items.indexOf(item));
    }
    else{
        System.out.println("Selection not possible");
    }
}
</code>
Regards
Piet

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

=?iso-8859-1?q?JComboBox= "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  Re: JComboBox.setSelected "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
      Re: JComboBox.setSelected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        =?UTF-8?B?U3lzdGVtLm91dC5 "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
          =?UTF-8?B?UmU6IFN5c3RlbS5 "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
            =?UTF-8?B?UmU6IFN5c3RlbS5 "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
              =?UTF-8?B?UmU6IFN5c3RlbS5 "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  =?utf-8?B?UmU6IEpDb21ib0J "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

csiph-web