ListListener wait on ActionListener Programming Software Development by CoilFyzx Hello good day. I am having trouble letting my listeners wait on each other. I have a 1. JComboBox 2. JList - groups 3. JList - students The choice from the JComboBox, clears and updates the groups JList by way of an actionlistener. The ListSelectionListener for the groups JList, then responds to you selecting data (that was just added). The … Re: ListListener wait on ActionListener Programming Software Development by JamesCherrill Your analysis of the problem seems reasonable. Why not just check the selection in JList ListSelectionListener and ignore the event if the selection is null? Re: ListListener wait on ActionListener Programming Software Development by mKorbel @JamesCherrill [please see OPs last post](http://www.daniweb.com/software-development/java/threads/471765/jcombobox-table-cell-editor-removing-items), seems to forgot to tell us that there is JDBC (can't found any words to wrote something cleaver there), then everything is ....??? or maybe isn't ??? Re: ListListener wait on ActionListener Programming Software Development by JamesCherrill Thanks for the link - hopefully OP will identify the exact source of the NPE to determine whether this is a Swing problem or something related to the underlying code. I have had similar problems in the past - ie replace the contents of a list box -> fires the list box listener multiple times, first time with no contents. Seemed to me at the time… Re: ListListener wait on ActionListener Programming Software Development by mKorbel @JamesCherrill - fires the list box listener multiple times ---> hehehe (I'm see that, know about) but why bothering with, is required to use MutableComboBoxModel, not to remove/add XxxListener added to JComboBox at runtime, - and using this model properly, with proper notifiers fireXxxXxx, then you can to manage all events that came from or… Re: ListListener wait on ActionListener Programming Software Development by JamesCherrill Yes, I agree with all that. He certainly should not be removing/adding listeners dynamically to fix this. Re: ListListener wait on ActionListener Programming Software Development by CoilFyzx Quite a hearty discussion going on here. The second thread that @mKorbel mentioned is from the same program. But they are completely different problems. @JamesCherrill I have realized that my analysis is right. I found a simple solution. I created a boolean variable that only turns changes until after the first action listener completes execution… java problem Programming Software Development by PROgamer …(new ButtonListener()); combo.addActionListener(new ButtonListener()); textf1.requestFocus(); } public class ListListener implements ListSelectionListener{ public void valueChanged(ListSelectionEvent ev){ if(listModel.size… JList, get String value Programming Software Development by Stjerne …(); // stores all the names into the array. // methods } private class ListListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { JList list = (JList… Re: JList, get String value Programming Software Development by Stjerne …: Harry Potter Pages: 400+ Author: ....... Review: ........... etc. With private class ListListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { JList list = (JList… Re: phone directory Programming Software Development by nanna ….getDocument(); String contacts= listModel.getElementAt(list.getSelectionIndex()).toString(); listSelectionModel.addListSelectionListener(listListener); class SharedListSelectionHandler implements ListSelectionListener { public void valueChanged(ListSelectionEvent e… Re: phone directory Programming Software Development by verruckt24 ….setVisibleRowCount(); [/code] And these : [code=java] contacts.addActionListener(listListener); contacts.getDocument(); listSelectionModel.addListSelectionListener(listListener); [/code] You cannot have anything other than member… Re: Jlist help Programming Software Development by abhi_elementx …the listener twice. my code: [CODE]private class ListListener implements ListSelectionListener { @Override public void valueChanged(ListSelectionEvent e…String emp_name = Employee_list.getSelectedValue().toString(); } }//class ListListener ends[/CODE] [B]emp_name is printed twice.[/B] why… Re: Help: need feedback on my Java assignment about thread sleep. It's already coded. Programming Software Development by darklordsatan … these files [code] JFontChooser$1.class JFontChooser$ButtonListener.class JFontChooser$ListListener.class JFontChooser.class [/code] As you can guess, I have… Re: JList - CellRendering Programming Software Development by Phaelax … last question, you need to add an ActionListener contactList.addActionListener(listListener) in the class would be 1 method, public void actionPerformed… Re: Help for JList and JPopupMenu Programming Software Development by Ashwin Vasnai [CODE] public class ListListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { try{ popupMenu.setVisible(… Re: Help for JList and JPopupMenu Programming Software Development by Ashwin Vasnai …=model1.getSize(); list =new JList(); list.removeAll(); list.addListSelectionListener(new ListListener()); for(int i=0;i<str.length;i++) model1… Re: java problem Programming Software Development by mKorbel at first of all put here [URL="http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]Use Formatted Text Fields[/URL] instead of JTestField set NumberFormat for example [CODE]NumberFormat formTextFieldFormat = NumberFormat.getNumberInstance(); formTextFieldFormat.setMinimumFractionDigits(… Re: java problem Programming Software Development by PROgamer [QUOTE=mKorbel;1613920]at first of all put here [URL="http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]Use Formatted Text Fields[/URL] instead of JTestField set NumberFormat for example [CODE]NumberFormat formTextFieldFormat = NumberFormat.getNumberInstance(); … Re: JList, get String value Programming Software Development by NormR1 > I tried getSelectedValues().toString(); but it didn't work What was returned? What was wong wiith it? Re: JList, get String value Programming Software Development by NormR1 You are printing the value from the JList. If you want more info you could use a Map with the Map's key = the title and Map's value being an object holding all the info for the book. Use the title to get the object from the Map. Re: JList, get String value Programming Software Development by Stjerne Hmm, I've never used Maps before. Is it some easier way to do this? Re: JList, get String value Programming Software Development by JamesCherrill You don't have to use Strings to populate a JList - you can use any Objects. JList by default will use the objects' toString() method to get the text to display in the list. . So you can add Book objects to the JList - Then `list.getSelectedValue()` will return the Book object itself, and you can use that to access whatever info you want to put… Re: JList, get String value Programming Software Development by NormR1 Maps are one of the easiest ways to do what you want.