@Override public void actionPerformed(ActionEvent e) { String[] addressArray = protocollo.getAddressMemory(); final ViewDialogPen dialog = new ViewDialogPen(view, "Nuova penna", addressArray); dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { if (dialog.option == ViewDialogPen.OPTION.OK) { Controller.this.addNewPen(dialog.getPen()); } } }); }
@Override public void actionPerformed(ActionEvent e) { String[] addressArray = protocollo.getAddressMemory(); final int indexPen = view.getIndexSelectedListPens(); final ViewDialogPen dialog = new ViewDialogPen(view, "Modifica penna", addressArray, pens[indexPen]); dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { if (dialog.option == ViewDialogPen.OPTION.OK) { Controller.this.updatePen(dialog.getPen(), indexPen); } } }); }