Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copy JList multiselect to another JList

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!!!

i have one JList and show all resordset....

i want selected rows and copy another JList

my code is:



i don't understand where is error....

help me please...
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You say there is an error: how do you know that?
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because don't copy in another jlist!!!

i want copy from "listEdit" to "listMdel"

don't exit nothing error but don't copy!!!

i hope you unsterstand me!!!

 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So have you done any debugging at all? Is the line of code inside the "rs.next()" loop ever called? Don't make us guess, tell us what is happening in that code. Remember that it's only a code fragment so we have no way of running it and finding out what it does.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you want all code for to see where is the problem???
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thi is all code:


 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i click to copy....

exit this message:

Error: QueryResult cannot be cast to java.lang.String

this error...for listModel or listEdit???
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously that isn't going to help because you are using a database. So, no. What you should do now is to ShowSomeEffort ( <-- follow that link and read it). After you read that, see if you can answer the question I already asked.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i understand....

but....

if i write:


the select is from JComboBox the program copy all file in another JList.....

but i write:


error!!!

this problem i don't understand.....
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with JCombobox i haven't problems!!!

 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul beppe wrote:error!!!


Again... How do you know there is an error? Let me refer you to another of our FAQ pages: TellTheDetails.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By error, do you mean compilation error?
are you using Java 1.7?
how are you declaring your JList and JComboBox variables?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic