Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't call method from another class
    primarykey
    data
    text
    <p>I have two classes. The main one opens the second one in a jframe in which the user will press a button and trigger a method from the main class/jframe <code>editare(String value)</code> that will automatically add some data to some jtextfields in the main jframe.The problem is that it won't trigger the method.I tried calling other methods from the main class,it doesn't call them either.I tried a lot of stuff for like the past 1-2 hours,can't figure it out.</p> <p>Here is some code : From the second jframe :</p> <pre><code>private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { Test2 test2=new Test2(); test2.citireser(list.getSelectedValue().toString()); //won't work.works if i call it from the same method,the main one test2.restart(); //won't work either this.dispose(); } </code></pre> <p>From the first jframe,the main one :</p> <pre><code>public void citireser(String cur) { try { serializedPath = "C:/Inter/" + cur; InputStream file = new FileInputStream(serializedPath); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new ObjectInputStream(buffer); String[] storeAllArraysREAD[] = (String[][]) input.readObject(); prodr = storeAllArraysREAD[0]; cantr = storeAllArraysREAD[1]; pretr = storeAllArraysREAD[2]; input.close(); buffer.close(); file.close(); System.err.println("prodr[1]= "+prodr[1].toString()); for (int m = 0; m &lt; prodr.length - 1; m++) { allprod.get(m).setText(prodr[m]); allcant.get(m).setText(cantr[m]); allpret.get(m).setText(pretr[m]); produsnou(); } } catch (ClassNotFoundException ex) { System.err.println("EROARE"); } catch (IOException ex) { System.err.println("EROARE"); } } </code></pre> <p>EDIT : Ok,after trying different stuff for a couple of hours i've got it.</p> <pre><code>public class Opt extends javax.swing.JFrame implements Printable { private final Test2 main; public Opt(Test2 aMain) { main = aMain; try { } catch (Exception e) { e.printStackTrace(); } initComponents(); jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0)); jScrollPane2.getVerticalScrollBar().setUnitIncrement(16); citirel(); if (list.getModel().getSize() == 0) { jButton1.setEnabled(false); jButton2.setEnabled(false); } } </code></pre> <p>Thanks for your help,i don't know who i should pick as the right answer :( Sorry to the other guy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload