Como faço para executar a classe HelloWorld no programa abaixo ?
import javax.swing.JFrame;
import javax.swing.JButton;
public class Teste2 extends JFrame {
private javax.swing.JPanel jContentPane = null;
private JButton jButton = null;
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("Executar HelloWorld");
jButton.setBounds(43, 48, 180, 43);
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// chamada
}
});
}
return jButton;
}
public static void main(String[] args) {
Teste2 n = new Teste2();
n.show();
}
/**
* This is the default constructor
*/
public Teste2() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
}
Classe HelloWorld :
public class HelloWorld {
public static void main(String args[]) {
System.out.println(“Hello World!”);
}
}
