eliangela não consegui ainda fiz um exemplo simples pra vc rodar ai pra ver o que desejo:
sem imports pra ficar mais facil.
//protocolo
package Interface;
/**
*
* @author Aldinei
*/
public class Protocolo2 extends javax.swing.JFrame {
/** Creates new form Protocolo2 */
public Protocolo2() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
fildmatricula = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
fildprof = new javax.swing.JTextField();
btpesquisa = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Matricula::");
jLabel2.setText("Profissional");
fildprof.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fildprofActionPerformed(evt);
}
});
btpesquisa.setText("pesquisa");
btpesquisa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btpesquisaActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fildmatricula, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(fildprof, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btpesquisa, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(fildmatricula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fildprof, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btpesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(55, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
public void setaMatfun(String m, String n){
fildmatricula.setText(m);
fildprof.setText(n);
System.out.println("Teste: "+fildmatricula.getText().toString());
System.out.println("Teste: "+fildprof.getText().toString());
}
private void fildprofActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btpesquisaActionPerformed(java.awt.event.ActionEvent evt) {
tabelapro tabela = new tabelapro();
tabela.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Protocolo2().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btpesquisa;
private javax.swing.JTextField fildmatricula;
private javax.swing.JTextField fildprof;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration
}
e a tabela
package Interface;
/**
*
* @author Aldinei
*/
public class tabelapro extends javax.swing.JFrame {
/** Creates new form tabelapro */
public tabelapro() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tabelapro = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
tabelapro.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{"00123", "Fulano de Tal "},
{"00124", "Jose"}
},
new String [] {
"Matricula", "Profissional"
}
));
tabelapro.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tabelaproMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tabelapro);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(22, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(63, 63, 63))
);
pack();
}// </editor-fold>
private void tabelaproMouseClicked(java.awt.event.MouseEvent evt) {
String m =((String) tabelapro.getValueAt(tabelapro.getSelectedRow(), 0));
String n= ((String) tabelapro.getValueAt(tabelapro.getSelectedRow(), 1));
Protocolo2 p = new Protocolo2();
p.setaMatfun(m, n);
this.dispose();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new tabelapro().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tabelapro;
// End of variables declaration
}
por gentileza da uma olhada e me diz o que tenho que fazer.
obrigado