this first class is my JFrame which creates the Frame
public class AGL12 extends JFrame{
protected int longueur,largeur;
public Container contConsole,contExplorerFichier,contListeMethode,contText;
public JInternalFrame f1,f2,f3,f4;
public JTextArea console,document;
public JDesktopPane dp;
public JScrollPane consolePane;
public JMenuBar barmenu;
public AGL12() {}
public void creationFenetre()
{
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
largeur=screenSize.height-10;
longueur=screenSize.width;
setSize(longueur,largeur);
setTitle("JavaCompilator ");
dp = new JDesktopPane();
setContentPane(dp);
contConsole=new Container();
contExplorerFichier=new Container();
contListeMethode=new Container();
contText=new Container();
f1=new JInternalFrame("",true,true,true,true);
f2=new JInternalFrame("",true,true,true,true);
f3=new JInternalFrame("Nouveau Document",true,true,true,true);
f4=new JInternalFrame("Console",true,true,true,true);
f1.setSize(longueur/10,(largeur-largeur/5)/2);
f1.setLocation(0,0);
f2.setSize(longueur/10,(largeur-largeur/5)/2);
f2.setLocation(0,2*largeur/5);
f3.setSize(9*longueur/10,4*largeur/5);
f3.setLocation(longueur/10,0);
f4.setSize(longueur,largeur/9);
f4.setLocation(0,4*largeur/5);
Vector v=new Vector();
v.add("a");
v.add("b");
v.add("c");
JTree jt1=new JTree(v);
JTree jt2=new JTree(v);
document=new JTextArea("c",20,20);
contExplorerFichier=f1.getContentPane();
contExplorerFichier.add(jt1);
contListeMethode=f2.getContentPane();
contListeMethode.add(jt2);
contText=f3.getContentPane();
contText.add(document);
contConsole=f4.getContentPane();
console=new JTextArea(2,1);
console.setText("Bleu");
consolePane=new JScrollPane(console);
contConsole.setSize(longueur,largeur/10);
contConsole.add(consolePane);
f1.setVisible(true);
f2.setVisible(true);
f3.setVisible(true);
f4.setVisible(true);
barmenu=new JMenuBar();
JMenu fichier=(new GestionMenuFichier()).createMenuFichier(f3);
barmenu.add(fichier);
JMenu edition=(new GestionMenuEdition()).createMenuEdition();
barmenu.add(edition);
setJMenuBar(barmenu);
dp.add(f1);
dp.add(f2);
dp.add(f3);
dp.add(f4);
show();
}
public static void main(
String[] args) {
AGL12 notAgl=new AGL12();
notAgl.creationFenetre();
}
}
--------------------------
//the Menu File
public class GestionMenuFichier{
public GestionMenuFichier() {
}
public JMenu createMenuFichier(JInternalFrame fr)
{
JMenu mFile = new JMenu("File");
mFile.setMnemonic('f');
Action actionNew = new AbstractAction("Nouveau Fichier")
{
public void actionPerformed(ActionEvent e)
{
// I want create a new JTextArea in my JFrame
// so I want to modify the JFrame which has been
// displayed
}
};
.
.
.
I don't know how to do the actionPerformed