Bonjour,
Existe il par defaut un "pointeur" vers l'objet courant mais de la classe "parente" ? Je crois que oui mais je ne sais plus comment on y fait reference, ou alors je reve....
Autrement dit dans le code suivant qui est un init d'applet, le this
fait reference à l'ActionListener, alors que je voudrais en fait utiliser l'objet applet courant....
D'avance merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
     // using a button to avoid the browser to fix the dimension of the applet
    // and to let the user not running the program if he wants not to
    public void init() {
        starter_button = new JButton("Run the OrganicBuilder.");
        starter_button.addActionListener(
            new ActionListener() { 
                public void actionPerformed( ActionEvent e ) { 
                     // safe as the source may only be this button
                    JButton starter_button = (JButton)e.getSource();
                    userInterface = new UI(this);
                    userInterface.setVisible(true);
                    starter_button.setText("OrganicBuilder is running ...");
                    starter_button.setEnabled(false);
                } 
            });
    }