This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBox stores same

 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The comboBox below, or variable str stores the table name selected thorugh the dropdown of the combobox twice. System.out.println(str); outputs:
test5
test5

Also; constructor initialization in the related class (public class Dat extends AbstractTableModel) through dtable = new Dat(str); happens twice, and since I use the table name to open the table for reading, the table gets opened twice. I have not idea of what is going on? Could you please read my code?
Thank you.

 
Rob Camick
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an ActionListener instead of an ItemListener.

An ItemListener has two states, selected/unselected.
 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! I did that and it works.
 
The moustache of a titan! The ad of a flea:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!