java - GUI not updating after a remove, revalidate, and repaint -
in program i'm creating, i'm showing local queue on gui, , letting user have option click button remove top element of queue, removing queue , panel. when try remove panel , "refresh" panel, works once.
screenshot of panel:
example of situation:
1) queue of 5 elements created , shown on panel
2) user clicks button remove top of queue
- top of queue deleted , removed screen
3) user clicks button remove top of queue again
- top of queue deleted not remove screen
(side note: adds resolvedtickets_ panel once well)
here code snippet; can provide more if need be:
public void actionperformed(actionevent evt) { if("removefromqueue".equals(evt.getactioncommand())){ system.out.println("removefromqueue button clicked"); if(empty()){ joptionpane.showmessagedialog(null, "queue empty! work."); return; } // removes top of queue screen mainframe.activequeue_.remove(queue.get(0)); // updates ui mainframe.activequeue_.revalidate(); mainframe.activequeue_.repaint(); resolved.add(queue.get(0)); // adds resolved tickets mainframe.resolvedtickets_.add(resolved.get(resolved_count)); resolved_count++; deletefirst(); // deletes queue } }
the deletefirst()
method:
public void deletefirst() { if (empty()) { return; } if (front.equals(null)) { rear = null; } front = front.getnext(); count--; }
thank , / or advice in advance.
Comments
Post a Comment