This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prevent Duplicate value from jlist to jlist by way of a jbutton

 
William Kohus
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I have so far. Now I just get the "No duplicates please!" message whenever I add anything to lbSelection.

I need to recognize that there is a duplicate and prevent the value from being entered into the list!

Any help you can provide would be greatly appreciated! Thanks!













HERE is the whole program

 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you really need to retain all the teams on the left?

Most similar-concept programs I've seen move the selection from the left to the right (or back),
meaning no possibility of duplicates.
 
William Kohus
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:do you really need to retain all the teams on the left?

Most similar-concept programs I've seen move the selection from the left to the right (or back),
meaning no possibility of duplicates.


I guess I don't need them but the text box above lbChoices is for a user to enter another team so I think I would need to keep them in the left side list.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Here is what I have so far. Now I just get the "No duplicates please!" message whenever I add anything to lbSelection.

OK, this bit looks easily fixable



now it shouldn't 'always' show.

do you still need help on duplicates? or was this all you were after?
 
William Kohus
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Here is what I have so far. Now I just get the "No duplicates please!" message whenever I add anything to lbSelection.

OK, this bit looks easily fixable



now it shouldn't 'always' show.

do you still need help on duplicates? or was this all you were after?


I was hoping that line would prevent my duplicates but it didn't! So yes, still need help preventing duplicates!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is just for the add single button
(comment out your old method, in case you need it later)

replace with this

 
William Kohus
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:this is just for the add single button
(comment out your old method, in case you need it later)

replace with this




Thanks so much! I couldn't stare at it any longer. This also helped me get the add all button working as well! Now if I can just figure out how to add text to the jlist from the jtextfield on a focuslost!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Now if I can just figure out how to add text to the jlist from the jtextfield on a focuslost!

really a bad idea (many reasons why accidental loss of focus),
better to add a little 'add' button beside the textfield
 
William Kohus
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Now if I can just figure out how to add text to the jlist from the jtextfield on a focuslost!

really a bad idea (many reasons why accidental loss of focus),
better to add a little 'add' button beside the textfield



100% agree with you! Thanks again for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic