Ciao a tutti!!
Ho un problema....
Ho 2 pannelli:
1) Bottoni contenente delle JText field e dei bottoni (classe Bottoni)
2) Tabella contenente una tabella che visualizza dei dati presenti nel mio dataBase. (Classe Tabella)

I due Pannelli sn richiamati e aggiunti in un JFrame.

Fin qui nessun problema!!!

Poi, ho creato una classe RowListener che dovrebbe selezionare la riga della tabella e caricare il contenuto nelle JTextField presenti nel pannello Bottoni.

Preciso che il problema dovrebbe essere nel modo in cui vado a richiamare il metodo. Perchè mettendo i pannelli e i metodi nella stessa classe funziona tutto perfettamente!!

:master: Penso di aver detto tutto... Vi posto il codice:

Pannello Bottoni:
codice:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.sql.SQLException;

import javax.swing.BorderFactory;
import javax.swing.DebugGraphics;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;


public class Bottoni extends JPanel {
	public JTable t;

	public JTextField id;
	public JTextField password;
	public JTextField nominativo;
	public JTextField username;
	public JTextField img;
	public JTextField dipartimento;
	public JTextField email;
	public JTextField tipo;
	public JTextField fax;

	
	
	public JTextField telefono;

	private static final long serialVersionUID = 1L;

	/**
	 * This is the default constructor
	 */
	public Bottoni() {
		super();
		initialize();

		{
			nominativo = new JTextField();
			this.add(nominativo);
			nominativo.setBounds(274, 85, 242, 22);
		}
		{
			username = new JTextField();
			this.add(username);
			username.setBounds(541, 84, 233, 22);
		}
		{
			password = new JTextField();
			this.add(password);
			password.setBounds(786, 82, 199, 22);
		}
		{
			id = new JTextField();
			this.add(id);
			id.setBounds(36, 85, 204, 22);
			id.setEnabled(false);
		}

		}
		}

		{
			JLabel labnominativo = new JLabel("");
			this.add(labnominativo);
			labnominativo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Nominativo.png")));
			labnominativo.setBounds(280, 60, 238, 26);
		}
		{
			JLabel labusername = new JLabel ("");
			this.add(labusername);
			labusername.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/username.png")));
			labusername.setBounds(547, 59, 221, 26);
		}
		{
			JLabel labpassword = new JLabel ("");
			this.add(labpassword);
			labpassword.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Password.png")));
			labpassword.setBounds(781, 59, 198, 26);
		}
		{
			JLabel labid = new JLabel ("") ;
			this.add(labid);
			labid.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Id utente.png")));
			labid.setBounds(36, 59, 238, 29);
		}
		{
			telefono = new JTextField();
			this.add(telefono);
			telefono.setBounds(324, 178, 192, 22);
		}
		{
			JLabel labtelefono = new JLabel("");
			this.add(labtelefono);
			labtelefono.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Telefono.png")));
			labtelefono.setBounds(324, 151, 238, 29);
		}
		{
			fax = new JTextField();
			this.add(fax);
			fax.setBounds(547, 176, 224, 22);
		}
		{
			tipo = new JTextField();
			this.add(tipo);
			tipo.setBounds(1004, 82, 233, 22);
		}
		{
			email = new JTextField();
			this.add(email);
			email.setBounds(789, 176, 198, 22);
		}
		{
			dipartimento = new JTextField();
			this.add(dipartimento);
			dipartimento.setBounds(40, 178, 275, 22);
		}
		{
			img = new JTextField();
			this.add(img);
			img.setBounds(1005, 177, 203, 22);
		}
		{
			JLabel labfax = new JLabel("");
			this.add(labfax);
			labfax.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Fax.png")));
			labfax.setBounds(547, 149, 159, 29);
		}
		{
			JLabel labtipo = new JLabel ("");
			this.add(labtipo);
			labtipo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Tipo Utente.png")));
			labtipo.setBounds(998, 57, 238, 29);
		}
		{
			JLabel labemail = new JLabel ("");
			this.add(labemail);
			labemail.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/E-mail.png")));
			labemail.setBounds(789, 148, 167, 29);
		}
		{
			JLabel labdipartimento = new JLabel("");
			this.add(labdipartimento);
			labdipartimento.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Dipartimento.png")));
			labdipartimento.setBounds(39, 151, 275, 29);
		}
		{
			JLabel labimmagine = new JLabel("") ;
			this.add(labimmagine);
			labimmagine.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Foto.png")));
			labimmagine.setBounds(1005, 150, 238, 29);

		}
	
		
		
	
		

		
		
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(1300, 400);
		this.setLayout(null);
		this.setName("this");
		//Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
			}
	        	    }


PannelloTabella:

codice:
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.SQLException;

import javax.swing.JPanel;
import javax.swing.JTable;
import Schedule.Oggetti.DeA.ModTab;


public class Tabella extends JPanel {

	@SuppressWarnings("unused")
	public JTable t;
	private static final long serialVersionUID = 1L;
	public Connection conn;
	public Bottoni b; 
	public RowListener r;

	public Tabella (ActionEvent e) throws SQLException{{
		
		initialize();
		
	
		ModTab miomodello = new ModTab("utente");
		t = new JTable(miomodello);
		
		
		{
			this.add( t);
			t.getSelectionModel().addListSelectionListener(new RowListener());
						t.setPreferredScrollableViewportSize(new Dimension(1000, 90));
			t.setBounds(0, 0, 1300, 139);
		}
		


	}
				
	}
	private void initialize() {
		this.setSize(1300, 400);
		this.setLayout(null);
		this.setName("this");
		
	}

}
Frame:
codice:
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;
import java.sql.SQLException;

public class Frame extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	public  Bottoni bottoni;
	public Tabella tab;

	public Frame() {
		super();
		this.setSize(1300, 800);
		this.setContentPane(getJContentPane());
		this.setTitle("JFrame");		
	}

	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.setBackground(new Color(204, 0, 204));
			
			Tabella tab;
			try {
				tab = new Tabella(null);
				jContentPane.add("NORTH", tab);
				tab.setBounds(0, 0, 1284, 400);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
			//tab.setBounds();

			Bottoni bottoni= new Bottoni();
			jContentPane.add("SOUTH", bottoni);
			bottoni.setBounds(0, 398, 1284, 365);
			//bottoni.setBounds();

		}
		return jContentPane;
	}

}
Metodo per selezionare riga e caricare testo in JTextField:

codice:
import java.sql.SQLException;

import javax.swing.JTable;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class RowListener implements ListSelectionListener {
	
    public JTable t;

	public void valueChanged(ListSelectionEvent event) {
        if (event.getValueIsAdjusting()) {
            return;
            
        }
        try {
		
        	Tabella tabel = new Tabella(null);
        	Bottoni b = new Bottoni();
        	int row = tabel.t.getSelectedRow();
		
        	System.out.println("hai selezionato la riga:" + row);
			
			b.id.setText ((String) tabel.t.getValueAt (row,0));
			b.nominativo.setText ((String)tabel.t.getValueAt (row,1));
			b.username.setText ((String) tabel.t.getValueAt (row,2));
			b.password.setText ((String) tabel.t.getValueAt (row,3));
			b.tipo.setText ((String) tabel.t.getValueAt (row,4));
			b.dipartimento.setText ((String) tabel.t.getValueAt (row,5));
			b.telefono.setText ((String) tabel.t.getValueAt (row,6));
			b.fax.setText ((String) tabel.t.getValueAt (row,7));
			b.email.setText ((String) tabel.t.getValueAt (row,8));
			b.img.setText ((String) tabel.t.getValueAt (row,9));
	    

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
    }
}
Aiutatemi!!!