ae pessoal alguem sabe dizer como resolver
package teste;
import pacote2.NewJFrame;
/**
*
* @author joaosavio
*/
public class Main {
public static void main(String[] args)
{
classeTeste teste = new classeTeste();
teste.setNome("joão");
NewJFrame frame = new NewJFrame();
frame.mudaNome();
frame.setVisible(true);
}
}
package teste;
/**
*
* @author joaosavio
*/
public class classeTeste
{
private String nome;
public void setNome(String name)
{
nome = name;
}
public String getNome()
{
return nome;
}
}
package pacote2;
import teste.classeTeste;
/**
*
* @author joaosavio
*/
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
label_nome = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
label_nome.setText("jose");
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(113, 113, 113)
.addComponent(label_nome, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(160, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(62, 62, 62)
.addComponent(label_nome, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(171, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel label_nome;
// End of variables declaration
public void mudaNome()
{
classeTeste test = new classeTeste();
label_nome.setText(test.getNome());
}
}
abraços