Saturday, 15 August 2015

java - How to Delete a row from jtable as well as database when selecting checkbox? -



java - How to Delete a row from jtable as well as database when selecting checkbox? -

i need delete specific row database displayed in jtable. want add together action listener on delete button. kind of new java programming facing problems.

my table code follow...

rt= st.executequery("select * login"); defaulttablemodel model=(defaulttablemodel) usertable.getmodel(); while(rt.next()){ username = rt.getstring(2); firstname = rt.getstring(5); lastname = rt.getstring(6); emailid = rt.getstring(1); accounttype = rt.getstring(4); model.addrow(new object[] {username, firstname, lastname, emailid, accounttype});

deleting jtable means deleting table's tablemodel. if you've created model yourself, model have method this, , method phone call fire notification method, here firetablerowsdeleted(...) inherited abstracttablemodel parent. if did not create model, you're using defaulttablemodel , phone call removerow(...) method.

as database, create , execute preparedstatement has delete command in it, , details of depend on database , code.

swing jtable , tablemodel tutorial. java database tutorial

java database swing jtable

No comments:

Post a Comment