0
Well I have a class that extends a JPanel
, in that JPanel
i add a JButton
and use the method addActionListener
to set a ActionListener
for this one JButton
, but when I’m creating the ActionListener
I can’t access the attributes of JPanel
, follows the code below:
public class MemoriaView extends JPanel {
private GenericAPI api;
private JButton salvar;
public MemoriaView(){
super();
this.setLayout(new MigLayout());
this.setSize(500,600);
this.api = new GenericAPI<MemoriaModel>();
this.salvar = new JButton("Salvar");
this.salvar.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
/* Aqui quero pode acessar o this.api porem nao consigo */
}
});
}