Como faço para usar o metodo setTitle neste caso ?
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Teste extends JFrame {
private JPanel jContentPane = null;
private JButton jButton = null;
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(51, 43, 192, 67);
jButton.setText("Troca Título do Frame");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// código para trocar o titulo do frame
}
});
}
return jButton;
}
public static void main(String[] args) {
Teste j = new Teste();
j.setVisible(true);
}
public Teste() {
super();
initialize();
}
private void initialize() {
this.setTitle("Teste");
this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
this.setSize(300,200);
this.setContentPane(getJContentPane());
}
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
}
