Cita:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Tabla1 extends Frame{
private Label[] l;
public Tabla1(int[] cliC, int[] tToC, int[] cli, int[] tto, int n){
l=new Label[n+2];
for(int i=0;i<n+1;++i)
l=new Label("");
setLayout(new GridLayout(n+2,1));
l[0]=new Label("N° Caja"+"\t"+"N° cltes atendidos"+"\t"+"Tpo. Total"+"\t"+"Tpo promedio");
add(l[0]);
int tot=0;
int cat=0;
int rat=0;
for(int j=1;j<n+1;++j){
l[j].setText((j+1)+ "\t" + cliC[j] + "\t" +tToC[j] +"\t"+(int)((tToC[j]*1.0/cliC[j])*100)/100);
add(l[j]);
tot=tot+cliC[j];
cat=cat+tToC[j];
}
rat=(int)(tot*1.0/cat*100)/100;//2 decimales
l[n+1]=new Label("Total" + "\t"+ tot + "\t" + cat+ "\t" + rat);
add(l[n+1]);
}
}
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Tabla1 extends Frame{
private Label[] l;
public Tabla1(int[] cliC, int[] tToC, int[] cli, int[] tto, int n){
l=new Label[n+2];
for(int i=0;i<n+1;++i)
l=new Label("");
setLayout(new GridLayout(n+2,1));
l[0]=new Label("N° Caja"+"\t"+"N° cltes atendidos"+"\t"+"Tpo. Total"+"\t"+"Tpo promedio");
add(l[0]);
int tot=0;
int cat=0;
int rat=0;
for(int j=1;j<n+1;++j){
l[j].setText((j+1)+ "\t" + cliC[j] + "\t" +tToC[j] +"\t"+(int)((tToC[j]*1.0/cliC[j])*100)/100);
add(l[j]);
tot=tot+cliC[j];
cat=cat+tToC[j];
}
rat=(int)(tot*1.0/cat*100)/100;//2 decimales
l[n+1]=new Label("Total" + "\t"+ tot + "\t" + cat+ "\t" + rat);
add(l[n+1]);
}
}
El problema es que lo llamo desde otro frame y solo me muestra 2 lineas, en vez de n...
porfavopr ayudenme, es urgente