i want create a program that click a button and then show the internalframe at the main frame (JFrame) but i duno y my program cannot run it...
below the simple program that i create....
can any ppl tell me how to do it and y my program cannot run...
thank you!!!
=====================================================================
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class a extends JFrame implements ActionListener{
JButton button_1;
JDesktopPane J;
private i I;
public a() {
JDesktopPane J= new JDesktopPane();
aLayout customLayout = new aLayout();
getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
getContentPane().setLayout(customLayout);
button_1 = new JButton("button_1");
getContentPane().add(button_1);
getContentPane().add(J, BorderLayout.CENTER);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
button_1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae){
J.add(new i());
}
public static void main(
String args[]) {
a window = new a();
window.setTitle("a");
window.pack();
window.show();
}
}