I am creating a project in which labels are generated automatically depending on a matrix.
The matrix contains notes from students and what I'm trying to do is create the labels automatically based on the notes in the matrix, that I have managed to do, but the problem is in the positioning.
I also create some labels automatically for the names of the students, but those of the notes are superimposed on the names and I can not move the matrix to the right for more dimensions that I put.
Deputy source and capture. This font is from the Performed action of the button which creates the labels of the names and notes
for(int i=0;i<calificacion.nombres().length;i++){
nombre = new JLabel();
nombre.setText(calificacion.getNombre(i));
jpResultado.add(nombre);
nombre.setBounds(20, 30*i, 50, 20);
nombre.setVisible(true);
}
for(int i=0; i<calificacion.notas().length;i++){
for(int j=0; j<calificacion.notas()[i].length;j++){
calificacion.getNota(i, j);
System.out.println("Notas : " + calificacion.getNota(i, j));
notas = new JLabel();
notas.setText(String.valueOf(calificacion.getNota(i, j)));
jpResultado.add(notas);
notas.setBounds(70*j, 30*i, 50, 20);
//notas.setLocation(30*k, 20*j);
}
}
this.pack();
As you can see in the image, everything is on the left and I can not position it further to the right