Login  Register

Re: help

Posted by ashish ram on Jun 24, 2009; 2:19pm
URL: http://imagej.273.s1.nabble.com/help-tp3692012p3692015.html

I think what you have sent me is not fully correct.Please have a look on
this.

class Result{
//Data fields...

}
public class Grid2 extends MouseAdapter implements PlugIn {
Result result[][];      // <<<--- I declare it, but it has no memory
assigned yet.


public void run(String arg) {
int rows, cols;

// <<<< Here you get matrix size in some way: from a textfield, as a
parameter at constructor, or whatever...

result = new Result[rows][cols];        *// <<--- Now I assign memory for
the matrix(but actually it wont allocate any memory because you //are not
calling the constructor and in my program it is causing an error)*


for(int p=0;p<32;p++){
for(int q=0;q<32;q++){
result[p][q] = new Result();
}
}
//*other codes here....which uses This array result[32][32]*
}//*run() ends here*

/*/some other codes that uses result*
}//PlugIn ends here


Please tell me about this.
Thanking you,
Ashish