Hi! I have made a POS Sotware. I have used only one JFrame as Main/Home Screen of the software and used JDialogs for all other screens.
In this post I have concern with the 2 screens; Home Screen(which is a Jframe) and Sales Screen(which is a JDialog). As Home Screen appears I instantiate an instance of the Sales Screen in the constructor of Home Screen as :
Sale sale = new Sale();
And on Pressing a Button on Home Screen I called :
In the WindowOpened Event of the "Sale" Screen I load the products data from database and populates a JComboBox. This all works perfectly.
But I face problem , when I dispose() the Sales Screen and Add a new Item on the "Products" Screen and when Return to Sales Screen , that new Item is not added to JComboBox. And I know that's because of window has opened only once, and constructor of sale has called only once.
But I want such a mechanism that when I dispose the "Sale" Screen and Add or delete new products by going to "Products" Screen, When I return to Sales Screen (By pressing the Button on Home Screen) Then the new item should be added to the JComboBox, i-e data should be refreshed and loaded into jComboBox. Kindly guide me how can I achieve this thing? Thanks in advance.