java - Filling JList with table -


does have tutorial fill jlist table sql query. jlist update every create or delete table.

select name sqlite_master type = 'table'; 

any appreciated.

this simple, not need tutorial :) build jlist resuting list of elements using this costructor.

iterate on query result cursor , fill vector elements got db. use vector underlying data container (model) building jlist:

vector<string> elements = new vector<string>(); while (query.next()) {     // or whatever appropriate     elements.add(query.getstring("name")); }   jlist mylist = new jlist(elements); 

you should split db query code (model related) gui building (view) ease future maintainance , decouple structure in so-called mvc structure, out of scope of question.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -