java - Display data in JTable with selection of check boxes in Swing -
string calltype = " "; if (local_checkbox.isselected()) { calltype = calltype + "and toc ='local'"; } if (std_checkbox.isselected()) { calltype = calltype + "and toc ='std'"; } if (isd_checkbox.isselected()) { calltype = calltype + "and toc ='isd'"; } if (incoming_checkbox.isselected()) { calltype = calltype + "and toc ='incoming'"; } if (transfered_checkbox.isselected()) { calltype = calltype + "and toc ='transfered'"; } if (conference_checkbox.isselected()) { calltype = calltype + "and toc ='conference'"; } if (missed_checkbox.isselected()) { calltype = calltype + "and toc ='missed'"; } int = 4; calltype = calltype.substring(i); calltype = calltype.replace("and", "or"); calltype = "and\t" + calltype; i++; try { class.forname("com.mysql.jdbc.driver").newinstance(); connection con1 = drivermanager.getconnection(db_url, user, pass); checkuserinputs chkusrin = new checkuserinputs(); query = chkusrin.formatquery(reporttype, resultdatefrom, resultdateto, empid, trunk, dialedno, duration, site, authcode, extension, cost, department, calltype, time); system.out.println(query); ps = con1.preparestatement(query); rs = ps.executequery(); table1.setmodel(dbutils.resultsettotablemodel(rs)); }catch(exception e) {} `
i have multiple check boxes. type of calls, check boxes std
, isd
, missed
etc.. in database have column named "type of calls" have values std
, isd
, missed
etc... task given me follows :
- to display data in
jtable
based on selection of check boxes. , if user selects check boxstd
, table show me std calls other details, , if user selects check boxisd
, table show meisd
calls other details , on. i'm able this. - problem when user selects multiple check boxes. select
isd
,std
, table has showstd
,isd
calls values.
the function formatquery has queries , conditions fetch data database.
how implement this?
Comments
Post a Comment