I want to update the contents of Jtable as shown below when the Jcombobox's item state is chaged in the left panel. but i am not being successful in it .Please help. untitled29

when the table no value is changed in the left panel , i want corresponding Jtable values updated/refreshed as per the table number. how can i do this. please help.

@godzab:
Please explain exactly how you think AtomicInteger is relevant here.

@47Pirates:
All you need is a simple listener that updates the table. Please post your latest/best attempt for further help.

Let me tell u that i've added two panels one with Jcombobox (Panel A)and another with Jtable (Panel B)so i need two update the Jtable of panel B from the item state chaged property of jcombobox from panel A. how can i do this please help.

You can write a public method in class B that updates the table using new info that is passed in as a parameter. Then you can just call that method from class A passing the latest value from the combo box.
Class A will need a reference to the class B instance, but whoever creates the instances of A nd B should be able to provide that.

I'm having little bit trouble with that referencing. Actually what i've done is, i design a jtable in class B passing the value in the constructor as:

public class ItemsTakenTable extends javax.swing.JPanel {





private Vector<Vector<Object>> data; //used for data from database
    private Vector<String> header;
    RestuarantServiceImpl rest = new RestuarantServiceImpl();
    int table;

    /** Creates new form ExistingRoomTypes */
    public ItemsTakenTable(int tableNo) {
        table = tableNo;
        data = rest.menuItemsUsedTable(tableNo);
        header = new Vector<String>();
        header.add("S.No");
        header.add("Item Name");
        header.add("Rate");
        header.add("Quantity");
        header.add("Total Price");
        initComponents();

    }

(I'm using drag and drop in netbeans)

And i've added those two panel in this way in mainframe.

        TableOrderPanel room = new TableOrderPanel();
        mainPanel.add(room);
        ItemsTakenTable table = new ItemsTakenTable(1);
        mainPanel.add(table);
        mainPanel.revalidate();

now how can i update table please suggest.

This question has already been answered. Start a new discussion instead.