0

i have written a code to out put the result of multiplication of two matrices using joption frame, but it outputs the result on separate windows, dont know how to output them on the same window.

this is my code:

```
'public class matrixmul {
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import javax.swing.JOptionPane;
/**
*
* @author CHARLES
*/
public class matrixmul {
public static void main(String[] args) {
String as, bs, muls, rowas, colas, rowbs, colbs,p=" \n\n";
int a[][]= new int[10][10];
int b[][]= new int[10][10];
int mul[][]= new int [10][10];
int rowa, cola,rowb, colb, i, j, k;
rowas= JOptionPane.showInputDialog("enter the number of rows for matrix A");
rowa= Integer.parseInt(rowas);
colas= JOptionPane.showInputDialog("enter the number of columns for matrix A");
cola= Integer.parseInt(colas);
rowbs=JOptionPane.showInputDialog("enter the number of columns for matrix B");
rowb= Integer.parseInt(rowbs);
colbs=JOptionPane.showInputDialog("enter the number of columns for matrix B");
colb=Integer.parseInt(colbs);
if (rowa==colb){
JOptionPane.showMessageDialog(null,"the operation is feasible, press the enter key to proceed!","operation test result",
JOptionPane.PLAIN_MESSAGE);
for(i=0;i<rowa;i++){
for(j=0;j<cola;j++){
as=JOptionPane.showInputDialog("enter the elements of matrix A ");
a[i][j]=Integer.parseInt(as);
}
}
for(i=0;i<rowb;i++){
for(j=0;j<colb;j++){
bs=JOptionPane.showInputDialog("enter the elements of matrix B /n");
b[i][j]=Integer.parseInt(bs);
}
}
for (i=0;i<rowa;i++){
for(j=0;j<colb;j++){
for(k=0;k<rowa;k++){
mul[i][j] = mul[i][j] + a[i][k] * b[k][j];
}
}
}
for(i=0;i<rowa;i++){
for(j=0;j<colb;j++){
JOptionPane.showMessageDialog(null," the resultant matrix is"+mul[i][j]+"\n","result",JOptionPane.PLAIN_MESSAGE);
}
}
}
System.exit(0);
}
}'
```