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 :

sale.visible(true);

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.

I saw this topic briefy late last night (C.E.S.T.) and it seemed odd. Now in the morning it still seems odd. It's not at all clear what is the problem here.
Whenever you add or delete products you need to update the combo box's contents (add or remove an item, or simply re-load the whole contents). What is it about that that is causing you difficulty?

commented: Thanks for your response James. I have added another reply and explained the problem in detail. Kindly go through it. +3

James bro, consider I have 3 screens, "Home" Screen, containing Menu Buttons, "Items" Screen where user can add or delete his products and "Sale" Screen where user can Sell his Items.
Home Screen is a JFrame and other two screens are JDialogs. I have two buttons on The Home Screen named "Manage Your Items" and "Sale your Items" , By pressing these buttons above mentioned JDiaolgs are opened (i-e "Items" Screen and Sale Screen)." All the items that are available in a table in "Items" Screen are also available in a ComboBox on "Sale" Screen.
When My "Home" Screen instantiates, I initializes the Sales Dialog as follows:

Sale sale = new Sale();

And when the button "Sale your Items" is pressed on Home Screen, The following code runs:

sale.visible(true);

After this code The "Sale" Screen(which is a JDialog) appears. This means that The" WindwoOpened event" of the "Sale" Screen has called. I overrides the "windowOPened Event" and loads all the Products data in ComboBox of "Sale" Screen. This all works perfectly.
But now consider I dismiss/close the "Sale" Screen by calling following code in the "WindowClosing Event Handler" of the Sale Screen:

setVisible(false);
    dispose();

And go to the "Items" Screen and add one more new Item successfully and dismiss/close the "Items" Screen, by calling :

setVisible(false);
dispose();

And go to the "Sale" Screen again by Pressing the "Manage Your Items" button on the Home Screen, the "Sale" Screen becomes visible again but now the ComboBox of "Sale "Screen has not the new Item that I has recently added, It has only previous Items. I hope You understand my problem. If not, then tell me, I will give you my software file so that you can run the file yourself and see the problem.
I will be thankful to you for your guidance.

OK, I get that.
Although the sale window is not visible, it still exists, with all its components. So you can update the contents of its combo box at any time. So when you add or remove items you need to update the combo box immediately. Then whenever you display the sale window the combo box will be up to date.
You just need to ensure that the code where you add or remove items has access to the combo box object... there are multiple ways to do that, which we can discuss if you want.

Yes I want to discuss those methods by which I can access the JcomboBox on the sales Screen from another window or Dialog.

You can start by considering these three options to see which fits your needs best...

  1. Make it public. Very easy, but horrible violation of encapsulation
  2. Have a public method (or methods) in Sale that updates the combo box - eg addItem(Item i) removeItem(Item i). A bit more code, and it encapsulates nicely, but creates an untidy dependency between the main Item list and the Sale window.
  3. Use a Listener/Observer pattern so the Sale window adds itself as a listener to wherever the master list of Items is held. This is the best architecture - classic MVC - but the most code.

Thanks James, For today, I have used your 2nd Mehtod/option i-e making public functions update(item) and remove(item).
But in future I want to use your 3rd Method/option i-e Adding the Sales screen as a listener itself. For this I want an example code or tutorial, if you can provide me, then I will thankful to you.

Sure. I'll get something together tomorrow. Goodnight. J

OK. Step 1: Separate the data from the user interface - ie separate the Model from the View.
You should have a class that loads and holds the master list of Items and has public methods for adding and removing items, getting items etc. It has no UI. The windows should be passed the manager instance into their constructors so they can use it to access whatever data or functionality they need.

Thank you very much James. I understood very well.

Great!
Let me know if/when that's done and I'll help you get the Listener stuff working.
JC