java - how to repaint the data of the JTable -


i have write following method create table when ever called every time list of task different table cannot change value of table

 public void displayalltaskbyprojectid(task[] task) {      system.out.println("success call");     /**      * table display tasks related selected project , timer      *      */     tbltasklist = new jtable();     log.info(" here");     int length;      defaulttablemodel dm = new defaulttablemodel(0, 0) {         private static final long serialversionuid = 1l;          public class getcolumnclass(int column) {             return getvalueat(0, column).getclass();         };          public boolean iscelleditable(int row, int column) {             switch (column) {             case 5:                 return true;             default:                 return false;             }          };     };     dm.firetabledatachanged();     string header[] = new string[] { "prority", "task title", "start",             "pause", "stop", "statulses" };     dm.setcolumnidentifiers(header);      // add image icon in table     imageicon imgstart = new imageicon("../../../../start.png");     imageicon imgstop = new imageicon("../../../../stop.png");     imageicon imgpause = new imageicon("../../../../pause.png");     length = task.length;     (int count = 0; count < length; count++) {         dm.addrow(new object[] { count, task[count].gettasktitle() + count,                 imgstart, imgpause, imgstop, "active" });     }     tbltasklist.setmodel(dm);     tablecolumn tbcstatus = tbltasklist.getcolumnmodel().getcolumn(5);     jcombobox cmbstatus = new jcombobox();     cmbstatus.setmodel(new defaultcomboboxmodel(new string[] { "active",             "close", "deactive", "offline" }));     tbcstatus.setcelleditor(new defaultcelleditor(cmbstatus));      tbltasklist.getcolumnmodel().getcolumn(0).setminwidth(0);     tbltasklist.getcolumnmodel().getcolumn(0).setmaxwidth(0);     tbltasklist.getcolumnmodel().getcolumn(1).setpreferredwidth(350);     tbltasklist.getcolumnmodel().getcolumn(2).setpreferredwidth(35);     tbltasklist.getcolumnmodel().getcolumn(3).setpreferredwidth(35);     tbltasklist.getcolumnmodel().getcolumn(4).setpreferredwidth(25);      tbltasklist.gettableheader().setreorderingallowed(false);     tbltasklist.gettableheader().setresizingallowed(false);     tbltasklist.setbounds(93, 34, 614, 324);      jsptasklist = new jscrollpane(tbltasklist);     jsptasklist.setopaque(false);     jsptasklist.setfocustraversalpolicyprovider(true);     jsptasklist.setbounds(108, 34, 605, 335);     frmtasklist.getcontentpane().add(jsptasklist); } 

please give me solution of problem possible fast

you should remove tbltasklist = new jtable(); displayalltaskbyprojectid function , code work properly.use line tbltasklist = new jtable() when init components


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -