public void actionPerformed(ActionEvent evt){
// gestiamo l'evento
Object src = evt.getSource(); // individuiamo il mittente della segnalazione
else if (src == prodotto) prodottoGUI();
else if (src == x) secondaMatrice(0);
}
public void prodottoGUI(){
//istruzioni per far inserire la seconda matrice int[][] a
popUp_matrice(x);
}
public void popUp_matrice(JButton button){
table2=new JTable(m.getRows(),m.getColumns());
popUp=new JDialog(this,"InserisciMatrice",true);
popUp.setBounds(500,40,600,200);
JPanel p=new JPanel();
p.add(table2);
p.add(button);
popUp.add(p);
button.addActionListener(this);
//popUp.setDefaultCloseOperation(JFrame.HIDE_ON_CLOS E);
System.out.println("Ho reso visibile la finestra");
popUp.setVisible(true);
}
public void secondaMatrice(int op){
//popUp.setVisible(false);
int r= m.getRows();
int c= m.getColumns();
a=new double[r][c];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
String s=(String)table2.getValueAt(i,j);
//System.out.print(s);
Double k =new Double(s);
a[i][j]=k.doubleValue();
}
}
System.out.println("Ho preso i valori");
popUp.setVisible(false);
System.out.println("reso invisibile la finestra");
//remove(popUp);
try{
switch(op)//questo è uno switch perchè c'è anche un'operazione di
somma
{
case 0:
m=remote_matrix.prodotto(m,a);//CHIAMATA RMI
break;
case 1: m=remote_matrix.somma(m,a);//CHIAMATA RMI
break;
}
visualizzaMatrice();
}catch(Exception e){System.out.println("Entrato
nell'eccezione "+e.getMessage()+" "+ e.getCause());}
}