0

I coded for selecting Items from Drug List window and getting that input to Edit Inventory Window.

But the problem is that by Clicking "select" button of the Drug List window opens another window of Edit Inventory.Not include selected data to the current Edit Inventory Window.

My code for Select button the Drug List;

private void selectBtnActionPerformed(java.awt.event.ActionEvent evt) {                                          
    String id = itemIDlbl.getText();
    String name = itemNamelbl.getText();

    try {
        InventoryManagementedit edit = new InventoryManagementedit();
        edit.get(id,name);
        this.dispose();
        edit.setVisible(true);
    } catch (SQLException ex) {
        Logger.getLogger(InventoryManagementeditList.class.getName()).log(Level.SEVERE, null, ex);
    }

} 

get() method for Edit Inventory for receive selected Items;

//getting input from the drug list window
public void get(String id, String name){
    IDcombo.setSelectedItem(id);
    Namecombo.setSelectedItem(name);
}

How to get the selected data to the current Edit Inventory not to a new window of Edit Inventory.

enter image description here

tenten
  • 1,276
  • 2
  • 26
  • 54

1 Answers1

0

No, you have to create a new Edit Inventory window, that window can only have the selected values, not in the current window.

You have to do like this:

When user clicks button in Edit Inventory, then close Edit Inventory (like this.dispose() ) and show Drugs list window (Create one object for the Drug Window, then visible the drug window like new DrugList.setVisible(true) ), then pass both values to the new window through get() method.

Thirunavukkarasu
  • 208
  • 6
  • 26