java - right click popup menu is not working properly (in jtable) -
its working first time after deleting line shows blank on popup menu in right click. think because of refresh method couldn't solve it.
private void refresh() { list<string> head = new arraylist<>(); head.add("id"); head.add("П/Н"); enlargealistablemodel model = new enlargealistablemodel(dbsql.listalis(), head) { // ***************** }; tblenlarge.setmodel(model); tblenlarge.addmouselistener(new mouseadapter() { @override public void mousereleased(mouseevent e) { if (e.ispopuptrigger()) { popup.removeall(); jmenuitem delete = new jmenuitem("delete"); delete.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { if (tblenlarge.getselectedrow() == -1) { } else { deleteenlargealis da = new deleteenlargealis(null, true, integer.parseint(tblenlarge.getvalueat(tblenlarge.getselectedrow(), 0).tostring())); da.setvisible(true); if (da.isok()) { ok = true; refresh(); } } } }); // ******************** popup.add(delete); popup.show(e.getcomponent(), e.getx(), e.gety()); } } });
Comments
Post a Comment