Hello everyone
I've a problem. I would like to send string workData from class MamboUi. jButton1ActionPerformed to class showData.showData where it will be worked
This is my code
public class MamboUI extends javax.swing.JFrame { public String anno; public String mese; public String workData; public MamboUI() { initComponents(); } [...] public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String anno = (String) comboAnno.getSelectedItem(); String mese = (String) comboMese.getSelectedItem(); workData = anno + " " +mese; showData t = new showData(); //Indirizzo la Classe = classe.java t.joe(); //indirizzo l'entry point } [...] }
public class showData extends JPanel{ static final String USERNAME = ""; static final String PASSWORD = ""; static final String CONN_STRING = "jdbc:mysql://localhost:3306/mambo"; String workData =""; public static void joe() { MamboUI dataFrom = new MamboUI(); JFrame jf = new JFrame(); showData t = new showData(); jf.setTitle("Test"); jf.setSize(1350,400); jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.add(t); } JTable jt; public showData () { MamboUI dataFrom = new MamboUI(this); workdata ??? <------- try { [....] DefaultTableModel tableModel = new DefaultTableModel(columnNames, 0); DefaultTableModel NomeGiorni = new DefaultTableModel(colonne, 0); Connection conn; conn = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD); Statement stmt = (Statement) conn.createStatement(); String query = "Select * from alldata where anno = "+anno+" and mese = "+mese+""; ResultSet rs = stmt.executeQuery(query); [...] }
Thank you in advance
paps