0

I have two jdialogs first purchase second find_Supplier where purchase is having two text fields and find_supplier has a jtable now what i want is to get values from jtable's specific cell and put them into text fields of first dialog on click of JButton. So far i am able to access values from jtable's cells but i can't put them into text fields

Here is the code for opening find_supplier dialog

find_supplier fs=new find_supplier(null,true);
fs.setVisible(true);

And here is the code to put values in text fields

purchase_item pi=new purchase_item(null, true);    
        pi.txtSupAddress.setText(address);
        pi.txtSupName.setText(name);
        this.dispose();
        //pi.setVisible(true) This opens new JDialog so no need of it 

Note: Both dialogs are modal

  • why don't you try to make global variables to be accessed by others ? – Basil Battikhi Apr 03 '16 at 20:21
  • If you don't get help soon, consider creating and posting a [Minimal, Complete, and Verifiable Example Program](http://stackoverflow.com/help/mcve) where you condense your code into the smallest bit that still compiles and runs, has no outside dependencies (such as need to link to a database or images), has no extra code that's not relevant to your problem, but still demonstrates your problem. – Hovercraft Full Of Eels Apr 03 '16 at 20:21
  • both address and name are global variables and even jtabel and that two jtextfields are public – Vishal Ruaut Apr 03 '16 at 20:36
  • Implement a method in `find_supplier` like `getTableData(int row, int col)`. – Dávid Horváth Apr 03 '16 at 20:38
  • You're posting code snippets without context. I'm not seeing how we can help in this situation. Please do yourself and us a favor and create a small little program, one with two JDialogs, and one that reproduces your problem, again a [mcve]. – Hovercraft Full Of Eels Apr 03 '16 at 20:38

0 Answers0