Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my JScrollpane not updating remove changes despite having validate() and repaint()
    text
    copied!<p>I have a terrible problem right now that's dooming my program at the moment. It seems that I can add elements to my ScrollPane via Jtable that has a custom model. It's fine when I add elements, the table updates and rows appear, etc etc. The real problem is when I remove elements it does not update the table no matter what. As a matter of fact, if I minimize the applet, then bring it up again, all the elements are now gone, but! the problem is that if I try to add new elements, they don't appear on ScrollPane even though the arraysize does grow when I add and shows my new elements when I println them. I've tried many things (you'll see with my repaints etc) but not sure what else i can do. thanks for any help :)</p> <pre><code> modelx = new HumanListModel(); final JTable newbiex = new JTable(modelx); newbiex.setDefaultRenderer(Human.class, new HumanRenderer()); newbiex.setFillsViewportHeight(true); newbiex.setVisible(true); playerViewer.setViewportView(newbiex); removeIndividual.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { playerViewer.remove(newbiex.getSelectedRow()); playerViewerExhibition.remove(newbiex.getSelectedRow()); ///modelx.remove(newbiex.getSelectedRow());/// modelx.removeElementAt(newbiex.getSelectedRow()); indexPoint -= 1;///helps keep track of index/// newbiex.repaint(); newbiex.revalidate(); newbiey.repaint(); ///table on another tab using modelx/// newbiey.revalidate();///table on another tab/// playerViewer.repaint(); playerViewer.revalidate(); System.out.println(modelx.size()); } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload