Jscrollpane not updating

Posted by / 23-Oct-2019 04:50

Jscrollpane not updating

I have a JScroll Pane and in it there is a JPanel with a Border Layout divided in NORTH and CENTER.In the NORHT and CENTER there are other two JPanel.programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums Hi, I have a swing application that gets football scores from a website using Jsoup.When the "Get Scores" button is pressed, the scores are printed to a JText Area with a JScroll Pane.But the rows and its values are not updated in the table. To change the table, you need to work with the table model. If you've subclassed Abstract Table Model, you'll have to create your own add/delete methods. Why don't my changes in the table model show up in the JTable view? The Abstract Table Model provides methods to do this, with names like fire Table Data Changed() and fire Table Rows Inserted(). Notification of the row being added will be generated. the following two Q&As says that Default Table Model will automatically update itself (source :: ---------------------------------------------------------------------------*--------------------------------------------------------- 3.3. Default Table Model contains methods to add/remove/reorder rows. Your method would make its change, then call the appropriate "fire" routine to notify listeners of exactly what happened, so they can go to the model and get the current state. ---------------------------------------------------------------------------*----------------------------------------------- but even though i used Default Table Model, its not working for me. initially, the panel displays the current data of the jtable. then, when a button is clicked, the contents of the table will change so i need to display that updated table again.

I just realised that i had declared the original instance of file Panel as an instance of JPanle rather than panel loader. The problem I am have is when I try to click on my button to switch to the next Panel it doesnt update the current one to change.

I've tried repaint(), revalidate(), and validate() on the scrollpane, the jlist, the panel, and the frame and the scroll pane won't update.

It updates fine if I add a new scrollpane with the new data in the array.

The problem is that I need to add buttons and label to the center panel but when I add these they do not appear.

I tried with validate() and repaint() method for the Center JPanel and then use set Vieport View but it does not function. Here is an example of code just to show what I mean.

jscrollpane not updating-47jscrollpane not updating-31jscrollpane not updating-49

I wan the scroll bar to stay where the user left it.