The following code does not make sense

public void showComponent () {
  for(int i=1;i<n;i++)
  VIEW2=showComponent;
}

It is the same as

public void showComponent () {
  VIEW2=showComponent;
}

Because you are asking java to do the same instruction: VIEW2=showComponent; n-1 times.


[b]for[/b] loop is used for doing repeated jobs. Normally works better with array.
i=1; // is for initialization (Normally, i will be set to 0, because array starts from 0, for example: if you define x[n], then you will have n variables: x[0], x[1],...[x[n-1])

Then it will do whatever inside the for loop,
when it is done, it will execute i++ (i++; is the same as i=i+1;).
So , i become 2, and it will do whatever inside the for loop again,
...  repeate if i<n is satisfied.