I am trying to call a method from another class that will add data to a jTable but the data doesn't show up in the table. If I add data from within the class that creates the table model, it works fine.
This works fine from Gui_Main:
This does not work when called from the Product class:
I've been able to confirm that the program flow is hitting the addData method by inserting a variable in the addPart method and showing it in the addData method. I've tried doing table refreshes and all other kinds of Java acrobatics to make this work based on other researched examples but have so far come up empty. Can anyone point me in the right direction?
Hello Penney, and welcome to the Ranch! You're probably adding the data to an instance of Gui_Main that is different from the one you have displayed. I say 'probably' because the code snippets you have posted are really not enough to diagnose the problem. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example).
Also, to conform to Java conventions, that class could be named GuiMain, not Gui_Main (it would be better still if the class name implied its purpose). Your package names Parts, Products and Inventory should be lowercase i.e. parts, products, inventory.
Since this is a Swing and not a JavaFX question, I've added it to the correct section of the Ranch.
There are no new questions, but there may be new answers.
OK. I've redone the code to be more a more complete reflection of what I'm doing.
Here's the other package that I'm trying to call from. I've made it so that it is simply a "Save" button that will call the method and theoretically should add another 4 lines to the table but it doesn't.
Let me know if there is anything else needed to clarify what I'm trying to do. You should be able to just copy/paste this code into your IDE and run it.